Commit e6e3d83d e6e3d83d3720cd45ab8c9b058cc0b9ec2053b9d8 by xianghan

1.优化

1 parent c86ef2b6
Showing 81 changed files with 772 additions and 459 deletions
...@@ -12,7 +12,6 @@ import java.sql.Timestamp; ...@@ -12,7 +12,6 @@ import java.sql.Timestamp;
12 import java.math.BigDecimal; 12 import java.math.BigDecimal;
13 13
14 import java.io.Serializable; 14 import java.io.Serializable;
15 import java.time.LocalDateTime;
16 15
17 /** 16 /**
18 * @author XiangHan 17 * @author XiangHan
...@@ -93,7 +92,7 @@ public class Coupon implements Serializable { ...@@ -93,7 +92,7 @@ public class Coupon implements Serializable {
93 92
94 /** 过期时间 */ 93 /** 过期时间 */
95 @Column(name = "expire_time") 94 @Column(name = "expire_time")
96 private LocalDateTime expireTime; 95 private Timestamp expireTime;
97 96
98 /** 自领取当日,几天内有效 */ 97 /** 自领取当日,几天内有效 */
99 @Column(name = "valid_days") 98 @Column(name = "valid_days")
......
...@@ -7,7 +7,6 @@ import org.springframework.beans.BeanUtils; ...@@ -7,7 +7,6 @@ import org.springframework.beans.BeanUtils;
7 7
8 import java.math.BigDecimal; 8 import java.math.BigDecimal;
9 import java.sql.Timestamp; 9 import java.sql.Timestamp;
10 import java.time.LocalDateTime;
11 import java.util.Objects; 10 import java.util.Objects;
12 11
13 /** 12 /**
...@@ -49,7 +48,7 @@ public class CouponBuilder { ...@@ -49,7 +48,7 @@ public class CouponBuilder {
49 Integer itemRange, 48 Integer itemRange,
50 Integer effectType, 49 Integer effectType,
51 Timestamp startTime, 50 Timestamp startTime,
52 LocalDateTime expireTime, 51 Timestamp expireTime,
53 Integer validDays,String description , Integer status){ 52 Integer validDays,String description , Integer status){
54 53
55 Coupon coupon = new Coupon(); 54 Coupon coupon = new Coupon();
......
...@@ -11,7 +11,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; ...@@ -11,7 +11,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
11 import java.sql.Timestamp; 11 import java.sql.Timestamp;
12 12
13 import java.io.Serializable; 13 import java.io.Serializable;
14 import java.time.LocalDateTime;
15 14
16 /** 15 /**
17 * @author XiangHan 16 * @author XiangHan
...@@ -51,11 +50,11 @@ public class CouponHistory implements Serializable { ...@@ -51,11 +50,11 @@ public class CouponHistory implements Serializable {
51 50
52 /** 领取时间 */ 51 /** 领取时间 */
53 @Column(name = "receive_time") 52 @Column(name = "receive_time")
54 private LocalDateTime receiveTime; 53 private Timestamp receiveTime;
55 54
56 /** 失效时间 */ 55 /** 失效时间 */
57 @Column(name = "expire_time") 56 @Column(name = "expire_time")
58 private LocalDateTime expireTime; 57 private Timestamp expireTime;
59 58
60 /** 使用状态 0:未使用;1:已使用;-1:已过期 */ 59 /** 使用状态 0:未使用;1:已使用;-1:已过期 */
61 @Column(name = "use_status") 60 @Column(name = "use_status")
...@@ -63,7 +62,7 @@ public class CouponHistory implements Serializable { ...@@ -63,7 +62,7 @@ public class CouponHistory implements Serializable {
63 62
64 /** 使用时间 */ 63 /** 使用时间 */
65 @Column(name = "use_time") 64 @Column(name = "use_time")
66 private LocalDateTime useTime; 65 private Timestamp useTime;
67 66
68 /** 订单详情id */ 67 /** 订单详情id */
69 @Column(name = "order_detail_id") 68 @Column(name = "order_detail_id")
...@@ -72,12 +71,12 @@ public class CouponHistory implements Serializable { ...@@ -72,12 +71,12 @@ public class CouponHistory implements Serializable {
72 /** 创建时间 */ 71 /** 创建时间 */
73 @CreatedDate 72 @CreatedDate
74 @Column(name = "create_time") 73 @Column(name = "create_time")
75 private LocalDateTime createTime; 74 private Timestamp createTime;
76 75
77 /** 更新时间 */ 76 /** 更新时间 */
78 @LastModifiedDate 77 @LastModifiedDate
79 @Column(name = "update_time") 78 @Column(name = "update_time")
80 private LocalDateTime updateTime; 79 private Timestamp updateTime;
81 80
82 public void copy(CouponHistory source){ 81 public void copy(CouponHistory source){
83 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); 82 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
......
1 package com.topdraw.business.module.coupon.history.domain; 1 package com.topdraw.business.module.coupon.history.domain;
2 2
3 import com.topdraw.business.module.coupon.domain.Coupon; 3 import com.topdraw.business.module.coupon.domain.Coupon;
4 import com.topdraw.util.TimestampUtil;
4 import org.apache.commons.lang3.StringUtils; 5 import org.apache.commons.lang3.StringUtils;
5 6
6 import java.time.LocalDateTime; 7 import java.sql.Timestamp;
7 import java.util.Objects; 8 import java.util.Objects;
8 9
9 /** 10 /**
...@@ -30,12 +31,12 @@ public class CouponHistoryBuilder { ...@@ -30,12 +31,12 @@ public class CouponHistoryBuilder {
30 31
31 public static CouponHistory build(Coupon coupon,Long userId,String userNickname,Long orderDetailId){ 32 public static CouponHistory build(Coupon coupon,Long userId,String userNickname,Long orderDetailId){
32 return build(null, 33 return build(null,
33 coupon.getId(),userId,coupon.getCode(),userNickname,LocalDateTime.now(), 34 coupon.getId(),userId,coupon.getCode(),userNickname, TimestampUtil.now(),
34 coupon.getExpireTime(),coupon.getStatus(),null,orderDetailId); 35 coupon.getExpireTime(),coupon.getStatus(),null,orderDetailId);
35 } 36 }
36 37
37 public static CouponHistory build(Long id , Long couponId , Long userId,String couponCode,String userNickname,LocalDateTime receiveTime, 38 public static CouponHistory build(Long id , Long couponId , Long userId, String couponCode, String userNickname, Timestamp receiveTime,
38 LocalDateTime expireTime,Integer useStatus,LocalDateTime useTime, 39 Timestamp expireTime, Integer useStatus, Timestamp useTime,
39 Long orderDetailId) { 40 Long orderDetailId) {
40 CouponHistory couponHistory = new CouponHistory(); 41 CouponHistory couponHistory = new CouponHistory();
41 couponHistory.setId(id); 42 couponHistory.setId(id);
......
...@@ -2,7 +2,7 @@ package com.topdraw.business.module.coupon.history.service.dto; ...@@ -2,7 +2,7 @@ package com.topdraw.business.module.coupon.history.service.dto;
2 2
3 import lombok.Data; 3 import lombok.Data;
4 import java.io.Serializable; 4 import java.io.Serializable;
5 import java.time.LocalDateTime; 5 import java.sql.Timestamp;
6 6
7 7
8 /** 8 /**
...@@ -28,23 +28,23 @@ public class CouponHistoryDTO implements Serializable { ...@@ -28,23 +28,23 @@ public class CouponHistoryDTO implements Serializable {
28 private String userNickname; 28 private String userNickname;
29 29
30 /** 领取时间 */ 30 /** 领取时间 */
31 private LocalDateTime receiveTime; 31 private Timestamp receiveTime;
32 32
33 /** 失效时间 */ 33 /** 失效时间 */
34 private LocalDateTime expireTime; 34 private Timestamp expireTime;
35 35
36 /** 使用状态 0:未使用;1:已使用;-1:已过期 */ 36 /** 使用状态 0:未使用;1:已使用;-1:已过期 */
37 private Integer useStatus; 37 private Integer useStatus;
38 38
39 /** 使用时间 */ 39 /** 使用时间 */
40 private LocalDateTime useTime; 40 private Timestamp useTime;
41 41
42 /** 订单详情id */ 42 /** 订单详情id */
43 private Long orderDetailId; 43 private Long orderDetailId;
44 44
45 /** 创建时间 */ 45 /** 创建时间 */
46 private LocalDateTime createTime; 46 private Timestamp createTime;
47 47
48 /** 更新时间 */ 48 /** 更新时间 */
49 private LocalDateTime updateTime; 49 private Timestamp updateTime;
50 } 50 }
......
...@@ -4,7 +4,6 @@ import lombok.Data; ...@@ -4,7 +4,6 @@ import lombok.Data;
4 import java.sql.Timestamp; 4 import java.sql.Timestamp;
5 import java.math.BigDecimal; 5 import java.math.BigDecimal;
6 import java.io.Serializable; 6 import java.io.Serializable;
7 import java.time.LocalDateTime;
8 7
9 8
10 /** 9 /**
...@@ -63,7 +62,7 @@ public class CouponDTO implements Serializable { ...@@ -63,7 +62,7 @@ public class CouponDTO implements Serializable {
63 private Timestamp startTime; 62 private Timestamp startTime;
64 63
65 /** 过期时间 */ 64 /** 过期时间 */
66 private LocalDateTime expireTime; 65 private Timestamp expireTime;
67 66
68 /** 自领取当日,几天内有效 */ 67 /** 自领取当日,几天内有效 */
69 private Integer validDays; 68 private Integer validDays;
......
...@@ -2,10 +2,6 @@ package com.topdraw.business.module.exp.history.service; ...@@ -2,10 +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 import java.util.Map;
8 import java.util.List;
9 5
10 /** 6 /**
11 * @author XiangHan 7 * @author XiangHan
......
1 package com.topdraw.business.module.exp.history.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author XiangHan
7 * @date 2021-10-22
8 */
9 @Data
10 public class ExpHistoryQueryCriteria{
11 }
...@@ -12,7 +12,7 @@ import org.springframework.data.annotation.LastModifiedDate; ...@@ -12,7 +12,7 @@ import org.springframework.data.annotation.LastModifiedDate;
12 import org.springframework.data.jpa.domain.support.AuditingEntityListener; 12 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
13 13
14 import java.io.Serializable; 14 import java.io.Serializable;
15 import java.time.LocalDateTime; 15 import java.sql.Timestamp;
16 16
17 /** 17 /**
18 * @author XiangHan 18 * @author XiangHan
...@@ -86,12 +86,12 @@ public class MemberAddress extends AsyncMqModule implements Serializable { ...@@ -86,12 +86,12 @@ public class MemberAddress extends AsyncMqModule implements Serializable {
86 /** 创建时间 */ 86 /** 创建时间 */
87 @CreatedDate 87 @CreatedDate
88 @Column(name = "create_time") 88 @Column(name = "create_time")
89 private LocalDateTime createTime; 89 private Timestamp createTime;
90 90
91 /** 更新时间 */ 91 /** 更新时间 */
92 @LastModifiedDate 92 @LastModifiedDate
93 @Column(name = "update_time") 93 @Column(name = "update_time")
94 private LocalDateTime updateTime; 94 private Timestamp updateTime;
95 95
96 public void copy(MemberAddress source){ 96 public void copy(MemberAddress source){
97 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); 97 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
......
...@@ -2,6 +2,7 @@ package com.topdraw.business.module.member.address.service.dto; ...@@ -2,6 +2,7 @@ package com.topdraw.business.module.member.address.service.dto;
2 2
3 import lombok.Data; 3 import lombok.Data;
4 import java.io.Serializable; 4 import java.io.Serializable;
5 import java.sql.Timestamp;
5 import java.time.LocalDateTime; 6 import java.time.LocalDateTime;
6 7
7 8
...@@ -58,8 +59,8 @@ public class MemberAddressDTO implements Serializable { ...@@ -58,8 +59,8 @@ public class MemberAddressDTO implements Serializable {
58 private String zipCode; 59 private String zipCode;
59 60
60 /** 创建时间 */ 61 /** 创建时间 */
61 private LocalDateTime createTime; 62 private Timestamp createTime;
62 63
63 /** 更新时间 */ 64 /** 更新时间 */
64 private LocalDateTime updateTime; 65 private Timestamp updateTime;
65 } 66 }
......
...@@ -13,7 +13,6 @@ import javax.persistence.*; ...@@ -13,7 +13,6 @@ import javax.persistence.*;
13 import javax.validation.constraints.NotNull; 13 import javax.validation.constraints.NotNull;
14 import java.io.Serializable; 14 import java.io.Serializable;
15 import java.sql.Timestamp; 15 import java.sql.Timestamp;
16 import java.time.LocalDateTime;
17 16
18 /** 17 /**
19 * @author XiangHan 18 * @author XiangHan
...@@ -32,7 +31,7 @@ public class Member implements Serializable { ...@@ -32,7 +31,7 @@ public class Member implements Serializable {
32 31
33 /** 会员过期时间 */ 32 /** 会员过期时间 */
34 @Column(name = "vip_expire_time", nullable = false) 33 @Column(name = "vip_expire_time", nullable = false)
35 private LocalDateTime vipExpireTime; 34 private Timestamp vipExpireTime;
36 35
37 /** 主键 */ 36 /** 主键 */
38 @Id 37 @Id
...@@ -119,7 +118,7 @@ public class Member implements Serializable { ...@@ -119,7 +118,7 @@ public class Member implements Serializable {
119 118
120 /** iptv账号绑定时间 */ 119 /** iptv账号绑定时间 */
121 @Column(name = "bind_iptv_time") 120 @Column(name = "bind_iptv_time")
122 private LocalDateTime bindIptvTime; 121 private Timestamp bindIptvTime;
123 122
124 /** 创建时间 */ 123 /** 创建时间 */
125 @CreatedDate 124 @CreatedDate
......
1 package com.topdraw.business.module.member.domain; 1 package com.topdraw.business.module.member.domain;
2 2
3
4 import com.topdraw.business.module.member.service.dto.MemberDTO;
5 import com.topdraw.util.IdWorker; 3 import com.topdraw.util.IdWorker;
6 import org.apache.commons.lang3.StringUtils; 4 import org.apache.commons.lang3.StringUtils;
7 5
8 import java.nio.charset.StandardCharsets;
9 import java.util.Base64;
10 import java.util.Objects; 6 import java.util.Objects;
11 7
12 /** 8 /**
......
...@@ -3,7 +3,6 @@ package com.topdraw.business.module.member.group.service.dto; ...@@ -3,7 +3,6 @@ package com.topdraw.business.module.member.group.service.dto;
3 import lombok.Data; 3 import lombok.Data;
4 import java.sql.Timestamp; 4 import java.sql.Timestamp;
5 import java.io.Serializable; 5 import java.io.Serializable;
6 import java.util.Set;
7 6
8 7
9 /** 8 /**
......
1 package com.topdraw.business.module.member.profile.domain; 1 package com.topdraw.business.module.member.profile.domain;
2 2
3 import com.topdraw.business.module.common.validated.CreateGroup;
4 import com.topdraw.business.module.common.validated.UpdateGroup; 3 import com.topdraw.business.module.common.validated.UpdateGroup;
5 import lombok.Data; 4 import lombok.Data;
6 import lombok.experimental.Accessors; 5 import lombok.experimental.Accessors;
......
...@@ -5,8 +5,6 @@ import com.topdraw.exception.GlobeExceptionMsg; ...@@ -5,8 +5,6 @@ import com.topdraw.exception.GlobeExceptionMsg;
5 import org.apache.commons.lang3.StringUtils; 5 import org.apache.commons.lang3.StringUtils;
6 import org.springframework.util.Assert; 6 import org.springframework.util.Assert;
7 7
8 import java.util.Objects;
9
10 public class MemberProfileBuilder { 8 public class MemberProfileBuilder {
11 9
12 public static MemberProfile build(Member member){ 10 public static MemberProfile build(Member member){
......
...@@ -15,7 +15,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; ...@@ -15,7 +15,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
15 import java.sql.Timestamp; 15 import java.sql.Timestamp;
16 16
17 import java.io.Serializable; 17 import java.io.Serializable;
18 import java.time.LocalDate;
19 18
20 /** 19 /**
21 * @author XiangHan 20 * @author XiangHan
......
...@@ -3,8 +3,6 @@ package com.topdraw.business.module.member.relatedinfo.service.dto; ...@@ -3,8 +3,6 @@ package com.topdraw.business.module.member.relatedinfo.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.LocalDate;
8 6
9 7
10 /** 8 /**
......
...@@ -4,7 +4,6 @@ import lombok.Data; ...@@ -4,7 +4,6 @@ import lombok.Data;
4 4
5 import java.sql.Timestamp; 5 import java.sql.Timestamp;
6 import java.io.Serializable; 6 import java.io.Serializable;
7 import java.time.LocalDate;
8 7
9 8
10 /** 9 /**
......
...@@ -4,7 +4,6 @@ import lombok.Data; ...@@ -4,7 +4,6 @@ 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.LocalDateTime;
8 7
9 8
10 /** 9 /**
...@@ -20,7 +19,7 @@ public class BasicMemberDTO implements Serializable { ...@@ -20,7 +19,7 @@ public class BasicMemberDTO implements Serializable {
20 private Integer iptvMajor; 19 private Integer iptvMajor;
21 20
22 /** vip过期时间 */ 21 /** vip过期时间 */
23 private LocalDateTime vipExpireTime; 22 private Timestamp vipExpireTime;
24 23
25 /** 主键 */ 24 /** 主键 */
26 private Long id; 25 private Long id;
...@@ -83,7 +82,7 @@ public class BasicMemberDTO implements Serializable { ...@@ -83,7 +82,7 @@ public class BasicMemberDTO implements Serializable {
83 private Integer bindIptvPlatformType; 82 private Integer bindIptvPlatformType;
84 83
85 /** iptv账号绑定时间 */ 84 /** iptv账号绑定时间 */
86 private LocalDateTime bindIptvTime; 85 private Timestamp bindIptvTime;
87 86
88 /** 创建时间 */ 87 /** 创建时间 */
89 private Timestamp createTime; 88 private Timestamp createTime;
......
...@@ -20,7 +20,7 @@ public class MemberDTO implements Serializable { ...@@ -20,7 +20,7 @@ public class MemberDTO implements Serializable {
20 private Integer iptvMajor; 20 private Integer iptvMajor;
21 21
22 /** vip过期时间 */ 22 /** vip过期时间 */
23 private LocalDateTime vipExpireTime; 23 private Timestamp vipExpireTime;
24 24
25 /** 主键 */ 25 /** 主键 */
26 private Long id; 26 private Long id;
...@@ -83,7 +83,7 @@ public class MemberDTO implements Serializable { ...@@ -83,7 +83,7 @@ public class MemberDTO implements Serializable {
83 private Integer bindIptvPlatformType; 83 private Integer bindIptvPlatformType;
84 84
85 /** iptv账号绑定时间 */ 85 /** iptv账号绑定时间 */
86 private LocalDateTime bindIptvTime; 86 private Timestamp bindIptvTime;
87 87
88 /** 创建时间 */ 88 /** 创建时间 */
89 private Timestamp createTime; 89 private Timestamp createTime;
......
...@@ -55,7 +55,7 @@ public class MemberServiceImpl implements MemberService { ...@@ -55,7 +55,7 @@ public class MemberServiceImpl implements MemberService {
55 @Override 55 @Override
56 public MemberDTO findById(Long id) { 56 public MemberDTO findById(Long id) {
57 Member member = this.memberRepository.findById(id).orElseGet(Member::new); 57 Member member = this.memberRepository.findById(id).orElseGet(Member::new);
58 ValidationUtil.isNull(member.getId(),"Member","id",id); 58 // ValidationUtil.isNull(member.getId(),"Member","id",id);
59 59
60 return this.memberMapper.toDto(member); 60 return this.memberMapper.toDto(member);
61 61
......
...@@ -12,7 +12,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; ...@@ -12,7 +12,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
12 import javax.persistence.*; 12 import javax.persistence.*;
13 import java.io.Serializable; 13 import java.io.Serializable;
14 import java.sql.Timestamp; 14 import java.sql.Timestamp;
15 import java.time.LocalDateTime;
16 15
17 /** 16 /**
18 * @author luerlong 17 * @author luerlong
...@@ -45,7 +44,7 @@ public class MemberVipHistory extends AsyncMqModule implements Serializable { ...@@ -45,7 +44,7 @@ public class MemberVipHistory extends AsyncMqModule implements Serializable {
45 44
46 // vip失效时间 45 // vip失效时间
47 @Column(name = "vip_expire_time") 46 @Column(name = "vip_expire_time")
48 private LocalDateTime vipExpireTime; 47 private Timestamp vipExpireTime;
49 48
50 // 状态 1正常 0已过期 49 // 状态 1正常 0已过期
51 @Column(name = "status") 50 @Column(name = "status")
......
...@@ -2,7 +2,7 @@ package com.topdraw.business.module.member.viphistory.domain; ...@@ -2,7 +2,7 @@ package com.topdraw.business.module.member.viphistory.domain;
2 2
3 import com.topdraw.business.module.member.domain.Member; 3 import com.topdraw.business.module.member.domain.Member;
4 4
5 import java.time.LocalDateTime; 5 import java.sql.Timestamp;
6 import java.util.Objects; 6 import java.util.Objects;
7 7
8 public class MemberVipHistoryBuilder { 8 public class MemberVipHistoryBuilder {
...@@ -10,7 +10,7 @@ public class MemberVipHistoryBuilder { ...@@ -10,7 +10,7 @@ public class MemberVipHistoryBuilder {
10 public static MemberVipHistory build(Member member , Integer beforeVip) { 10 public static MemberVipHistory build(Member member , Integer beforeVip) {
11 Long id = member.getId(); 11 Long id = member.getId();
12 Integer vip = member.getVip(); 12 Integer vip = member.getVip();
13 LocalDateTime vipExpireTime = member.getVipExpireTime(); 13 Timestamp vipExpireTime = member.getVipExpireTime();
14 14
15 MemberVipHistory memberVipHistory = new MemberVipHistory(); 15 MemberVipHistory memberVipHistory = new MemberVipHistory();
16 memberVipHistory.setMemberId(Objects.isNull(id)? null:id); 16 memberVipHistory.setMemberId(Objects.isNull(id)? null:id);
...@@ -20,7 +20,7 @@ public class MemberVipHistoryBuilder { ...@@ -20,7 +20,7 @@ public class MemberVipHistoryBuilder {
20 return build(memberVipHistory); 20 return build(memberVipHistory);
21 } 21 }
22 22
23 public static MemberVipHistory build(Long memberId, Integer vip, Integer beforeVip, LocalDateTime vipExpireTime ) { 23 public static MemberVipHistory build(Long memberId, Integer vip, Integer beforeVip, Timestamp vipExpireTime ) {
24 MemberVipHistory memberVipHistory = new MemberVipHistory(); 24 MemberVipHistory memberVipHistory = new MemberVipHistory();
25 memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId); 25 memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId);
26 memberVipHistory.setVip(Objects.isNull(vip)? null:vip); 26 memberVipHistory.setVip(Objects.isNull(vip)? null:vip);
...@@ -38,7 +38,7 @@ public class MemberVipHistoryBuilder { ...@@ -38,7 +38,7 @@ public class MemberVipHistoryBuilder {
38 memberVipHistory.getStatus()); 38 memberVipHistory.getStatus());
39 } 39 }
40 40
41 public static MemberVipHistory build(Long id, Long memberId , Integer vip , Integer beforeVip , LocalDateTime vipExpireTime, Integer status){ 41 public static MemberVipHistory build(Long id, Long memberId , Integer vip , Integer beforeVip , Timestamp vipExpireTime, Integer status){
42 MemberVipHistory memberVipHistory = new MemberVipHistory(); 42 MemberVipHistory memberVipHistory = new MemberVipHistory();
43 memberVipHistory.setId(Objects.isNull(id)? null:id); 43 memberVipHistory.setId(Objects.isNull(id)? null:id);
44 memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId) ; 44 memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId) ;
......
...@@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member; ...@@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member;
4 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; 4 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
5 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; 5 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
6 6
7 import java.sql.Timestamp;
7 import java.time.LocalDateTime; 8 import java.time.LocalDateTime;
8 9
9 /** 10 /**
...@@ -49,6 +50,6 @@ public interface MemberVipHistoryService { ...@@ -49,6 +50,6 @@ public interface MemberVipHistoryService {
49 * @param nowTime 50 * @param nowTime
50 * @return 51 * @return
51 */ 52 */
52 MemberVipHistory findByTime(Long id, LocalDateTime nowTime); 53 MemberVipHistory findByTime(Long id, Timestamp nowTime);
53 54
54 } 55 }
......
...@@ -4,7 +4,6 @@ import lombok.Data; ...@@ -4,7 +4,6 @@ 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.LocalDateTime;
8 7
9 8
10 /** 9 /**
...@@ -27,7 +26,7 @@ public class MemberVipHistoryDTO implements Serializable { ...@@ -27,7 +26,7 @@ public class MemberVipHistoryDTO implements Serializable {
27 private Integer beforeVip; 26 private Integer beforeVip;
28 27
29 // vip失效时间 28 // vip失效时间
30 private LocalDateTime vipExpireTime; 29 private Timestamp vipExpireTime;
31 30
32 // 状态 1正常 0已过期 31 // 状态 1正常 0已过期
33 private Integer status; 32 private Integer status;
......
1 package com.topdraw.business.module.member.viphistory.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author luerlong
7 * @date 2021-12-10
8 */
9 @Data
10 public class MemberVipHistoryQueryCriteria {
11 }
...@@ -11,6 +11,7 @@ import com.topdraw.business.module.member.viphistory.repository.MemberVipHistory ...@@ -11,6 +11,7 @@ import com.topdraw.business.module.member.viphistory.repository.MemberVipHistory
11 import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; 11 import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService;
12 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; 12 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
13 import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHistoryMapper; 13 import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHistoryMapper;
14 import com.topdraw.util.TimestampUtil;
14 import com.topdraw.utils.ValidationUtil; 15 import com.topdraw.utils.ValidationUtil;
15 import lombok.extern.slf4j.Slf4j; 16 import lombok.extern.slf4j.Slf4j;
16 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Propagation;
20 import org.springframework.transaction.annotation.Transactional; 21 import org.springframework.transaction.annotation.Transactional;
21 import org.springframework.util.Assert; 22 import org.springframework.util.Assert;
22 23
24 import java.sql.Timestamp;
23 import java.time.LocalDateTime; 25 import java.time.LocalDateTime;
24 26
25 /** 27 /**
...@@ -85,8 +87,9 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { ...@@ -85,8 +87,9 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService {
85 } 87 }
86 88
87 @Override 89 @Override
88 public MemberVipHistory findByTime(Long memberId, LocalDateTime nowTime) { 90 public MemberVipHistory findByTime(Long memberId, Timestamp nowTime) {
89 MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findByTime(memberId, nowTime).orElseGet(MemberVipHistory::new); 91 LocalDateTime localDateTime = TimestampUtil.timestamp2LocalDateTime(nowTime);
92 MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findByTime(memberId, localDateTime).orElseGet(MemberVipHistory::new);
90 return memberVipHistory; 93 return memberVipHistory;
91 } 94 }
92 95
......
1 package com.topdraw.business.module.points.available.domain; 1 package com.topdraw.business.module.points.available.domain;
2 2
3 import com.fasterxml.jackson.annotation.JsonFormat;
4 import com.topdraw.business.module.common.domain.AsyncMqModule; 3 import com.topdraw.business.module.common.domain.AsyncMqModule;
5 import lombok.Data; 4 import lombok.Data;
6 import lombok.experimental.Accessors; 5 import lombok.experimental.Accessors;
...@@ -11,7 +10,6 @@ import org.springframework.data.annotation.CreatedDate; ...@@ -11,7 +10,6 @@ import org.springframework.data.annotation.CreatedDate;
11 import org.springframework.data.annotation.LastModifiedDate; 10 import org.springframework.data.annotation.LastModifiedDate;
12 import org.springframework.data.jpa.domain.support.AuditingEntityListener; 11 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
13 import java.sql.Timestamp; 12 import java.sql.Timestamp;
14 import java.time.LocalDateTime;
15 13
16 import java.io.Serializable; 14 import java.io.Serializable;
17 15
...@@ -55,9 +53,9 @@ public class PointsAvailable extends AsyncMqModule implements Serializable { ...@@ -55,9 +53,9 @@ public class PointsAvailable extends AsyncMqModule implements Serializable {
55 private Long points; 53 private Long points;
56 54
57 /** 过期时间 */ 55 /** 过期时间 */
58 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "") 56 // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "")
59 @Column(name = "expire_time") 57 @Column(name = "expire_time")
60 private LocalDateTime expireTime; 58 private Timestamp expireTime;
61 59
62 /** 描述 */ 60 /** 描述 */
63 @Column(name = "description") 61 @Column(name = "description")
......
...@@ -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 , Timestamp now);
29 29
30 /** 30 /**
31 * 即将过期的积分 31 * 即将过期的积分
......
...@@ -5,6 +5,7 @@ import com.topdraw.business.module.points.available.service.dto.PointsAvailableD ...@@ -5,6 +5,7 @@ import com.topdraw.business.module.points.available.service.dto.PointsAvailableD
5 import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria; 5 import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria;
6 import org.springframework.data.domain.Pageable; 6 import org.springframework.data.domain.Pageable;
7 7
8 import java.sql.Timestamp;
8 import java.time.LocalDateTime; 9 import java.time.LocalDateTime;
9 import java.util.Map; 10 import java.util.Map;
10 import java.util.List; 11 import java.util.List;
...@@ -59,7 +60,7 @@ public interface PointsAvailableService { ...@@ -59,7 +60,7 @@ public interface PointsAvailableService {
59 * @param timestamp 60 * @param timestamp
60 * @return 61 * @return
61 */ 62 */
62 List<PointsAvailableDTO> findByMemberIdAndExpireTimeBefore(Long memberId, LocalDateTime timestamp); 63 List<PointsAvailableDTO> findByMemberIdAndExpireTimeBefore(Long memberId, Timestamp timestamp);
63 64
64 /** 65 /**
65 * 即将过期的积分 66 * 即将过期的积分
......
...@@ -32,7 +32,7 @@ public class PointsAvailableDTO implements Serializable { ...@@ -32,7 +32,7 @@ public class PointsAvailableDTO implements Serializable {
32 private Long points; 32 private Long points;
33 33
34 /** 过期时间 */ 34 /** 过期时间 */
35 private LocalDateTime expireTime; 35 private Timestamp expireTime;
36 36
37 /** 描述 */ 37 /** 描述 */
38 private String description; 38 private String description;
......
...@@ -15,6 +15,7 @@ import org.springframework.dao.EmptyResultDataAccessException; ...@@ -15,6 +15,7 @@ import org.springframework.dao.EmptyResultDataAccessException;
15 import org.springframework.util.Assert; 15 import org.springframework.util.Assert;
16 import com.topdraw.utils.StringUtils; 16 import com.topdraw.utils.StringUtils;
17 17
18 import java.sql.Timestamp;
18 import java.time.LocalDateTime; 19 import java.time.LocalDateTime;
19 import java.util.*; 20 import java.util.*;
20 21
...@@ -120,7 +121,7 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -120,7 +121,7 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
120 } 121 }
121 122
122 @Override 123 @Override
123 public List<PointsAvailableDTO> findByMemberIdAndExpireTimeBefore(Long memberId, LocalDateTime timestamp) { 124 public List<PointsAvailableDTO> findByMemberIdAndExpireTimeBefore(Long memberId, Timestamp timestamp) {
124 return Objects.nonNull(memberId)? 125 return Objects.nonNull(memberId)?
125 this.pointsAvailableMapper.toDto(this.pointsAvailableRepository.findByMemberIdAndExpireTimeBefore(memberId, timestamp)) 126 this.pointsAvailableMapper.toDto(this.pointsAvailableRepository.findByMemberIdAndExpireTimeBefore(memberId, timestamp))
126 :null; 127 :null;
......
...@@ -2,10 +2,6 @@ package com.topdraw.business.module.points.detail.detailhistory.service; ...@@ -2,10 +2,6 @@ package com.topdraw.business.module.points.detail.detailhistory.service;
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.service.dto.PointsDetailHistoryDTO; 4 import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO;
5 import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria;
6 import org.springframework.data.domain.Pageable;
7 import java.util.Map;
8 import java.util.List;
9 5
10 /** 6 /**
11 * @author XiangHan 7 * @author XiangHan
...@@ -14,31 +10,28 @@ import java.util.List; ...@@ -14,31 +10,28 @@ import java.util.List;
14 public interface PointsDetailHistoryService { 10 public interface PointsDetailHistoryService {
15 11
16 /** 12 /**
17 * 查询数据分页
18 * @param criteria 条件参数
19 * @param pageable 分页参数
20 * @return Map<String,Object>
21 */
22 Map<String,Object> queryAll(PointsDetailHistoryQueryCriteria criteria, Pageable pageable);
23
24 /**
25 * 查询所有数据不分页
26 * @param criteria 条件参数
27 * @return List<PointsDetailHistoryDTO>
28 */
29 List<PointsDetailHistoryDTO> queryAll(PointsDetailHistoryQueryCriteria criteria);
30
31 /**
32 * 根据ID查询 13 * 根据ID查询
33 * @param id ID 14 * @param id ID
34 * @return PointsDetailHistoryDTO 15 * @return PointsDetailHistoryDTO
35 */ 16 */
36 PointsDetailHistoryDTO findById(Long id); 17 PointsDetailHistoryDTO findById(Long id);
37 18
19 /**
20 *
21 * @param resources
22 */
38 void create(PointsDetailHistory resources); 23 void create(PointsDetailHistory resources);
39 24
25 /**
26 *
27 * @param resources
28 */
40 void update(PointsDetailHistory resources); 29 void update(PointsDetailHistory resources);
41 30
31 /**
32 *
33 * @param id
34 */
42 void delete(Long id); 35 void delete(Long id);
43 36
44 /** 37 /**
......
1 package com.topdraw.business.module.points.detail.detailhistory.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author XiangHan
7 * @date 2021-10-22
8 */
9 @Data
10 public class PointsDetailHistoryQueryCriteria{
11 }
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.aspect.AsyncMqSend;
4 import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory; 3 import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory;
5 import com.topdraw.utils.ValidationUtil; 4 import com.topdraw.utils.ValidationUtil;
6 import com.topdraw.business.module.points.detail.detailhistory.repository.PointsDetailHistoryRepository; 5 import com.topdraw.business.module.points.detail.detailhistory.repository.PointsDetailHistoryRepository;
7 import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService; 6 import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService;
8 import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; 7 import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO;
9 import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria;
10 import com.topdraw.business.module.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper; 8 import com.topdraw.business.module.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper;
11 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
13 import org.springframework.transaction.annotation.Propagation; 11 import org.springframework.transaction.annotation.Propagation;
14 import org.springframework.transaction.annotation.Transactional; 12 import org.springframework.transaction.annotation.Transactional;
15 import org.springframework.dao.EmptyResultDataAccessException; 13 import org.springframework.dao.EmptyResultDataAccessException;
16 import org.springframework.data.domain.Page;
17 import org.springframework.data.domain.Pageable;
18 import org.springframework.util.Assert; 14 import org.springframework.util.Assert;
19 import com.topdraw.utils.PageUtil;
20 import com.topdraw.utils.QueryHelp;
21 import com.topdraw.utils.StringUtils; 15 import com.topdraw.utils.StringUtils;
22 16
23 import java.util.List;
24 import java.util.Map;
25
26 /** 17 /**
27 * @author XiangHan 18 * @author XiangHan
28 * @date 2021-10-22 19 * @date 2021-10-22
...@@ -32,60 +23,45 @@ import java.util.Map; ...@@ -32,60 +23,45 @@ import java.util.Map;
32 public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryService { 23 public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryService {
33 24
34 @Autowired 25 @Autowired
35 private PointsDetailHistoryRepository PointsDetailHistoryRepository; 26 private PointsDetailHistoryRepository pointsDetailHistoryRepository;
36 27
37 @Autowired 28 @Autowired
38 private PointsDetailHistoryMapper PointsDetailHistoryMapper; 29 private PointsDetailHistoryMapper pointsDetailHistoryMapper;
39
40 @Override
41 public Map<String, Object> queryAll(PointsDetailHistoryQueryCriteria criteria, Pageable pageable) {
42 Page<PointsDetailHistory> page = PointsDetailHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
43 return PageUtil.toPage(page.map(PointsDetailHistoryMapper::toDto));
44 }
45
46 @Override
47 public List<PointsDetailHistoryDTO> queryAll(PointsDetailHistoryQueryCriteria criteria) {
48 return PointsDetailHistoryMapper.toDto(PointsDetailHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
49 }
50 30
51 @Override 31 @Override
52 public PointsDetailHistoryDTO findById(Long id) { 32 public PointsDetailHistoryDTO findById(Long id) {
53 PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(id).orElseGet(PointsDetailHistory::new); 33 PointsDetailHistory pointsDetailHistory = this.pointsDetailHistoryRepository.findById(id).orElseGet(PointsDetailHistory::new);
54 ValidationUtil.isNull(PointsDetailHistory.getId(),"PointsDetailHistory","id",id); 34 ValidationUtil.isNull(pointsDetailHistory.getId(),"PointsDetailHistory","id",id);
55 return PointsDetailHistoryMapper.toDto(PointsDetailHistory); 35 return this.pointsDetailHistoryMapper.toDto(pointsDetailHistory);
56 } 36 }
57 37
58 @Override 38 @Override
59 @Transactional(rollbackFor = Exception.class) 39 @Transactional(rollbackFor = Exception.class)
60 @AsyncMqSend()
61 public void create(PointsDetailHistory resources) { 40 public void create(PointsDetailHistory resources) {
62 PointsDetailHistoryRepository.save(resources); 41 this.pointsDetailHistoryRepository.save(resources);
63 } 42 }
64 43
65 @Override 44 @Override
66 @Transactional(rollbackFor = Exception.class) 45 @Transactional(rollbackFor = Exception.class)
67 @AsyncMqSend()
68 public void update(PointsDetailHistory resources) { 46 public void update(PointsDetailHistory resources) {
69 PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(resources.getId()).orElseGet(PointsDetailHistory::new); 47 PointsDetailHistory pointsDetailHistory = this.pointsDetailHistoryRepository.findById(resources.getId()).orElseGet(PointsDetailHistory::new);
70 ValidationUtil.isNull( PointsDetailHistory.getId(),"PointsDetailHistory","id",resources.getId()); 48 ValidationUtil.isNull( pointsDetailHistory.getId(),"PointsDetailHistory","id",resources.getId());
71 PointsDetailHistory.copy(resources); 49 pointsDetailHistory.copy(resources);
72 PointsDetailHistoryRepository.save(PointsDetailHistory); 50 this.pointsDetailHistoryRepository.save(pointsDetailHistory);
73 } 51 }
74 52
75 @Override 53 @Override
76 @Transactional(rollbackFor = Exception.class) 54 @Transactional(rollbackFor = Exception.class)
77 @AsyncMqSend()
78 public void delete(Long id) { 55 public void delete(Long id) {
79 Assert.notNull(id, "The given id must not be null!"); 56 Assert.notNull(id, "The given id must not be null!");
80 PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(id).orElseThrow( 57 PointsDetailHistory pointsDetailHistory = this.pointsDetailHistoryRepository.findById(id).orElseThrow(
81 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsDetailHistory.class, id), 1)); 58 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsDetailHistory.class, id), 1));
82 PointsDetailHistoryRepository.delete(PointsDetailHistory); 59 this.pointsDetailHistoryRepository.delete(pointsDetailHistory);
83 } 60 }
84 61
85
86 @Override 62 @Override
87 public PointsDetailHistoryDTO getByCode(String code) { 63 public PointsDetailHistoryDTO getByCode(String code) {
88 return StringUtils.isNotEmpty(code) ? PointsDetailHistoryMapper.toDto(PointsDetailHistoryRepository.findFirstByCode(code).orElseGet(PointsDetailHistory::new)) 64 return StringUtils.isNotEmpty(code) ? this.pointsDetailHistoryMapper.toDto(this.pointsDetailHistoryRepository.findFirstByCode(code).orElseGet(PointsDetailHistory::new))
89 : new PointsDetailHistoryDTO(); 65 : new PointsDetailHistoryDTO();
90 } 66 }
91 } 67 }
......
...@@ -59,7 +59,7 @@ public class Rights implements Serializable { ...@@ -59,7 +59,7 @@ public class Rights implements Serializable {
59 59
60 /** 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数 */ 60 /** 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数 */
61 @Column(name = "expire_time") 61 @Column(name = "expire_time")
62 private Long expireTime; 62 private Timestamp expireTime;
63 63
64 /** 创建时间 */ 64 /** 创建时间 */
65 @CreatedDate 65 @CreatedDate
......
...@@ -56,7 +56,7 @@ public class RightsHistory extends AsyncMqModule implements Serializable { ...@@ -56,7 +56,7 @@ public class RightsHistory extends AsyncMqModule implements Serializable {
56 56
57 // 失效时间 57 // 失效时间
58 @Column(name = "expire_time") 58 @Column(name = "expire_time")
59 private LocalDateTime expireTime; 59 private Timestamp expireTime;
60 60
61 @CreatedDate 61 @CreatedDate
62 @Column(name = "create_time") 62 @Column(name = "create_time")
......
...@@ -33,7 +33,7 @@ public class RightsHistoryDTO implements Serializable { ...@@ -33,7 +33,7 @@ public class RightsHistoryDTO implements Serializable {
33 private Timestamp sendTime; 33 private Timestamp sendTime;
34 34
35 // 失效时间 35 // 失效时间
36 private LocalDateTime expireTime; 36 private Timestamp expireTime;
37 37
38 private Timestamp createTime; 38 private Timestamp createTime;
39 39
......
...@@ -37,7 +37,7 @@ public class RightsDTO implements Serializable { ...@@ -37,7 +37,7 @@ public class RightsDTO implements Serializable {
37 private Timestamp validTime; 37 private Timestamp validTime;
38 38
39 /** 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数 */ 39 /** 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数 */
40 private Long expireTime; 40 private Timestamp expireTime;
41 41
42 /** 创建时间 */ 42 /** 创建时间 */
43 private Timestamp createTime; 43 private Timestamp createTime;
......
...@@ -53,15 +53,15 @@ public class TaskAttrServiceImpl implements TaskAttrService { ...@@ -53,15 +53,15 @@ public class TaskAttrServiceImpl implements TaskAttrService {
53 @Transactional(rollbackFor = Exception.class) 53 @Transactional(rollbackFor = Exception.class)
54 public void delete(Long id) { 54 public void delete(Long id) {
55 Assert.notNull(id, "The given id must not be null!"); 55 Assert.notNull(id, "The given id must not be null!");
56 TaskAttr TaskAttr = this.taskAttrRepository.findById(id).orElseThrow( 56 TaskAttr taskAttr = this.taskAttrRepository.findById(id).orElseThrow(
57 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", TaskAttr.class, id), 1)); 57 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", TaskAttr.class, id), 1));
58 this.taskAttrRepository.delete(TaskAttr); 58 this.taskAttrRepository.delete(taskAttr);
59 } 59 }
60 60
61 @Override 61 @Override
62 public TaskAttrDTO findByTaskId(Long taskId) { 62 public TaskAttrDTO findByTaskId(Long taskId) {
63 TaskAttr TaskAttr = this.taskAttrRepository.findByTaskId(taskId).orElseGet(TaskAttr::new); 63 TaskAttr taskAttr = this.taskAttrRepository.findByTaskId(taskId).orElseGet(TaskAttr::new);
64 return this.taskAttrMapper.toDto(TaskAttr); 64 return this.taskAttrMapper.toDto(taskAttr);
65 } 65 }
66 66
67 67
......
1 package com.topdraw.business.module.task.domain; 1 package com.topdraw.business.module.task.domain;
2 2
3 import com.topdraw.business.module.common.validated.CreateGroup;
3 import lombok.Data; 4 import lombok.Data;
4 import lombok.experimental.Accessors; 5 import lombok.experimental.Accessors;
5 import cn.hutool.core.bean.BeanUtil; 6 import cn.hutool.core.bean.BeanUtil;
6 import cn.hutool.core.bean.copier.CopyOptions; 7 import cn.hutool.core.bean.copier.CopyOptions;
7 import javax.persistence.*; 8 import javax.persistence.*;
9 import javax.validation.constraints.NotNull;
10
8 import org.springframework.data.annotation.CreatedDate; 11 import org.springframework.data.annotation.CreatedDate;
9 import org.springframework.data.annotation.LastModifiedDate; 12 import org.springframework.data.annotation.LastModifiedDate;
10 import org.springframework.data.jpa.domain.support.AuditingEntityListener; 13 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...@@ -31,8 +34,12 @@ public class Task implements Serializable { ...@@ -31,8 +34,12 @@ public class Task implements Serializable {
31 34
32 /** 任务模板id */ 35 /** 任务模板id */
33 @Column(name = "task_template_id", nullable = false) 36 @Column(name = "task_template_id", nullable = false)
37 @NotNull(message = "taskTemplateId is null", groups = {CreateGroup.class})
34 private Long taskTemplateId; 38 private Long taskTemplateId;
35 39
40 @Transient
41 private String taskTemplateCode;
42
36 /** 任务重复类型,-1:不限次;1:单次;>1:多次 */ 43 /** 任务重复类型,-1:不限次;1:单次;>1:多次 */
37 @Column(name = "task_repeat_type", nullable = false) 44 @Column(name = "task_repeat_type", nullable = false)
38 private Integer taskRepeatType; 45 private Integer taskRepeatType;
...@@ -51,7 +58,7 @@ public class Task implements Serializable { ...@@ -51,7 +58,7 @@ public class Task implements Serializable {
51 58
52 /** 任务失效时间 */ 59 /** 任务失效时间 */
53 @Column(name = "expire_time") 60 @Column(name = "expire_time")
54 private LocalDateTime expireTime; 61 private Timestamp expireTime;
55 62
56 /** 显示顺序 */ 63 /** 显示顺序 */
57 @Column(name = "sequence") 64 @Column(name = "sequence")
...@@ -117,10 +124,33 @@ public class Task implements Serializable { ...@@ -117,10 +124,33 @@ public class Task implements Serializable {
117 @Column(name = "rights3_amount") 124 @Column(name = "rights3_amount")
118 private Integer rights3Amount; 125 private Integer rights3Amount;
119 126
127 /** 会员专享 0:会员专享 1:非会员专享 */
128 @Column(name = "member_exclusive")
129 private Integer memberExclusive;
130
120 /** 状态 0:失效;1:生效 */ 131 /** 状态 0:失效;1:生效 */
121 @Column(name = "status", nullable = false) 132 @Column(name = "status", nullable = false)
122 private Integer status; 133 private Integer status;
123 134
135 /** 任务名称 */
136 @Column(name = "name", nullable = false)
137 private String name;
138
139 /** 编号 */
140 @Column(name = "code", nullable = false)
141 private String code;
142
143 /** 任务描述 */
144 @Column(name = "description", nullable = false)
145 private String description;
146
147 /** 删除标识 0:正常;1:已删除;*/
148 @Column(name = "delete_mark", nullable = false)
149 private Integer deleteMark;
150
151 @Transient
152 private String attr;
153
124 /** 创建时间 */ 154 /** 创建时间 */
125 @CreatedDate 155 @CreatedDate
126 @Column(name = "create_time") 156 @Column(name = "create_time")
......
...@@ -24,30 +24,31 @@ public class TaskBuilder { ...@@ -24,30 +24,31 @@ public class TaskBuilder {
24 24
25 Task task_ = new Task(); 25 Task task_ = new Task();
26 task_.setTaskTemplateId(task.getTaskTemplateId()); 26 task_.setTaskTemplateId(task.getTaskTemplateId());
27 task_.setTaskTemplateCode(task.getTaskTemplateCode());
27 28
28 //task_.setName(task.getName()); 29 task_.setName(task.getName());
29 //task_.setCode(StringUtils.isEmpty(task.getCode()) ? IdWorker.generatorCode("task_") : task.getCode()); 30 task_.setCode(StringUtils.isEmpty(task.getCode()) ? IdWorker.generatorCode("task_") : task.getCode());
30 task_.setStatus(Objects.isNull(task.getStatus()) ? 1 : task.getStatus()); 31 task_.setStatus(Objects.isNull(task.getStatus()) ? 1 : task.getStatus());
31 task_.setSequence(task.getSequence()); 32 task_.setSequence(task.getSequence());
32 task_.setValidTime(Objects.isNull(task.getValidTime()) ? TimestampUtil.now() : task.getValidTime()); 33 task_.setValidTime(Objects.isNull(task.getValidTime()) ? TimestampUtil.now() : task.getValidTime());
33 task_.setExpireTime(task.getExpireTime()); 34 task_.setExpireTime(task.getExpireTime());
34 //task_.setDescription(task.getDescription()); 35 task_.setDescription(task.getDescription());
35 task_.setActionAmount(task.getActionAmount()); 36 task_.setActionAmount(task.getActionAmount());
36 task_.setTaskDailyReset(Objects.isNull(task.getTaskDailyReset()) ? 1 : task.getTaskDailyReset()); 37 task_.setTaskDailyReset(Objects.isNull(task.getTaskDailyReset()) ? 1 : task.getTaskDailyReset());
37 task_.setTaskRepeatType(Objects.isNull(task.getTaskRepeatType()) ? 1 : task.getTaskRepeatType()); 38 task_.setTaskRepeatType(Objects.isNull(task.getTaskRepeatType()) ? 1 : task.getTaskRepeatType());
38 task_.setRightsSendStrategy(Objects.isNull(task.getRightsSendStrategy()) ? 1 : task.getRightsSendStrategy()); 39 task_.setRightsSendStrategy(Objects.isNull(task.getRightsSendStrategy()) ? 1 : task.getRightsSendStrategy());
39 40
40 task_.setGroups(task.getGroups()); 41 task_.setGroups(task.getGroups());
41 task_.setMemberLevel(task.getMemberLevel()); 42 task_.setMemberLevel(Objects.isNull(task.getMemberLevel()) ? 1 : task.getMemberLevel());
42 task_.setMemberVip(task.getMemberVip()); 43 task_.setMemberVip(Objects.isNull(task.getMemberVip()) ? 0 : task.getMemberVip());
43 //task_.setMemberExclusive(task.getMemberExclusive()); 44 task_.setMemberExclusive(Objects.isNull(task.getMemberExclusive()) ? 1 : 0);
44 45
45 task_.setPointsType(Objects.isNull(task.getPointsType()) ? 1 : task.getPointsType()); 46 task_.setPointsType(Objects.isNull(task.getPointsType()) ? 0 : task.getPointsType());
46 task_.setRewardPoints(Objects.isNull(task.getRewardPoints()) ? null : task.getRewardPoints()); 47 task_.setRewardPoints(Objects.isNull(task.getRewardPoints()) ? 0 : task.getRewardPoints());
47 //task_.setRewardPointsExpireTime(Objects.isNull(task.getRewardPointsExpireTime()) ? 48 task_.setRewardPointsExpireTime(Objects.isNull(task.getRewardPointsExpireTime()) ?
48 // DateUtil.getLastDateTimeSecondYearLong() : task.getRewardPointsExpireTime()); 49 DateUtil.getLastDateTimeSecondYearLong() : task.getRewardPointsExpireTime());
49 //task_.setRewardMaxPoints(Objects.isNull(task.getRewardMaxPoints()) ? 50 task_.setRewardMaxPoints(Objects.isNull(task.getRewardMaxPoints()) ?
50 //RandomUtil.getRandomPoints(1, 10).intValue() : task.getRewardMaxPoints()); 51 RandomUtil.getRandomPoints(1, 10).intValue() : task.getRewardMaxPoints());
51 52
52 task_.setRewardExp(Objects.isNull(task.getRewardExp()) ? 0L : task.getRewardExp()); 53 task_.setRewardExp(Objects.isNull(task.getRewardExp()) ? 0L : task.getRewardExp());
53 54
...@@ -58,7 +59,10 @@ public class TaskBuilder { ...@@ -58,7 +59,10 @@ public class TaskBuilder {
58 task_.setRights3Id(task.getRights3Id()); 59 task_.setRights3Id(task.getRights3Id());
59 task_.setRights3Amount(task.getRights3Amount()); 60 task_.setRights3Amount(task.getRights3Amount());
60 61
61 return task; 62 task_.setDeleteMark(Objects.isNull(task.getDeleteMark()) ? 0 : task.getDeleteMark());
63
64 task_.setAttr(StringUtils.isBlank(task.getAttr()) ? null : task.getAttr());
65 return task_;
62 } 66 }
63 67
64 } 68 }
......
...@@ -3,8 +3,12 @@ package com.topdraw.business.module.task.repository; ...@@ -3,8 +3,12 @@ package com.topdraw.business.module.task.repository;
3 import com.topdraw.business.module.task.domain.Task; 3 import com.topdraw.business.module.task.domain.Task;
4 import org.springframework.data.jpa.repository.JpaRepository; 4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 import org.springframework.data.jpa.repository.Modifying;
7 import org.springframework.data.jpa.repository.Query;
8 import org.springframework.transaction.annotation.Transactional;
6 9
7 import java.util.List; 10 import java.util.List;
11 import java.util.Optional;
8 12
9 /** 13 /**
10 * @author XiangHan 14 * @author XiangHan
...@@ -14,4 +18,10 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat ...@@ -14,4 +18,10 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
14 18
15 List<Task> findByTaskTemplateId(Long taskTemplateId); 19 List<Task> findByTaskTemplateId(Long taskTemplateId);
16 20
21 @Modifying
22 @Transactional
23 @Query(value = "UPDATE `tr_task` SET `delete_mark` = 1 , `update_time` = now() WHERE `id` = ?1", nativeQuery = true)
24 void updateDeleteMark(Long id);
25
26 Optional<Task> findByCode(String code);
17 } 27 }
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
11 public interface TaskService { 11 public interface TaskService {
12 12
13 /** 13 /**
14 * 根据ID查询 14 *
15 * @param id ID 15 * @param id ID
16 * @return TaskDTO 16 * @return TaskDTO
17 */ 17 */
...@@ -19,8 +19,39 @@ public interface TaskService { ...@@ -19,8 +19,39 @@ public interface TaskService {
19 19
20 /** 20 /**
21 * 21 *
22 * @param code 编号
23 * @return TaskDTO
24 */
25 TaskDTO findByCode(String code);
26
27 /**
28 *
22 * @param taskTemplateId 29 * @param taskTemplateId
23 * @return 30 * @return
24 */ 31 */
25 List<Task> findByTemplateId(Long taskTemplateId); 32 List<Task> findByTemplateId(Long taskTemplateId);
33
34 /**
35 *
36 * @param task
37 */
38 TaskDTO create(Task task);
39
40 /**
41 *
42 * @param task
43 */
44 TaskDTO update(Task task);
45
46 /**
47 *
48 * @param task
49 */
50 void delete(Task task);
51
52 /**
53 *
54 * @param id
55 */
56 void delete(Long id);
26 } 57 }
......
...@@ -2,6 +2,7 @@ package com.topdraw.business.module.task.service.dto; ...@@ -2,6 +2,7 @@ package com.topdraw.business.module.task.service.dto;
2 2
3 import lombok.Data; 3 import lombok.Data;
4 4
5 import javax.persistence.Column;
5 import java.sql.Timestamp; 6 import java.sql.Timestamp;
6 import java.io.Serializable; 7 import java.io.Serializable;
7 import java.time.LocalDateTime; 8 import java.time.LocalDateTime;
...@@ -19,6 +20,9 @@ public class TaskDTO implements Serializable { ...@@ -19,6 +20,9 @@ public class TaskDTO implements Serializable {
19 /** 任务模板id */ 20 /** 任务模板id */
20 private Long taskTemplateId; 21 private Long taskTemplateId;
21 22
23 /** 删除标识 0:正常;1:已删除;*/
24 private Integer deleteMark;
25
22 /** 任务重复类型,-1:不限次;1:单次;>1:多次 */ 26 /** 任务重复类型,-1:不限次;1:单次;>1:多次 */
23 private Integer taskRepeatType; 27 private Integer taskRepeatType;
24 28
...@@ -32,7 +36,7 @@ public class TaskDTO implements Serializable { ...@@ -32,7 +36,7 @@ public class TaskDTO implements Serializable {
32 private Timestamp validTime; 36 private Timestamp validTime;
33 37
34 /** 任务失效时间 */ 38 /** 任务失效时间 */
35 private LocalDateTime expireTime; 39 private Timestamp expireTime;
36 40
37 /** 显示顺序 */ 41 /** 显示顺序 */
38 private Integer sequence; 42 private Integer sequence;
...@@ -73,9 +77,23 @@ public class TaskDTO implements Serializable { ...@@ -73,9 +77,23 @@ public class TaskDTO implements Serializable {
73 /** 权益3数量 */ 77 /** 权益3数量 */
74 private Integer rights3Amount; 78 private Integer rights3Amount;
75 79
80 /** 会员专享 0:会员专享 1:非会员专享 */
81 private Integer memberExclusive;
82
76 /** 状态 0:失效;1:生效 */ 83 /** 状态 0:失效;1:生效 */
77 private Integer status; 84 private Integer status;
78 85
86 /** 任务名称 */
87 private String name;
88
89 /** 编号 */
90 private String code;
91
92 /** 任务描述 */
93 private String description;
94
95 private String attr;
96
79 /** 创建时间 */ 97 /** 创建时间 */
80 private Timestamp createTime; 98 private Timestamp createTime;
81 99
......
1 package com.topdraw.business.module.task.service.impl; 1 package com.topdraw.business.module.task.service.impl;
2 2
3 import com.topdraw.business.module.task.domain.Task; 3 import com.topdraw.business.module.task.domain.Task;
4 import com.topdraw.utils.ValidationUtil;
5 import com.topdraw.business.module.task.repository.TaskRepository; 4 import com.topdraw.business.module.task.repository.TaskRepository;
6 import com.topdraw.business.module.task.service.TaskService; 5 import com.topdraw.business.module.task.service.TaskService;
7 import com.topdraw.business.module.task.service.dto.TaskDTO; 6 import com.topdraw.business.module.task.service.dto.TaskDTO;
...@@ -10,8 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,8 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
11 import org.springframework.transaction.annotation.Propagation; 10 import org.springframework.transaction.annotation.Propagation;
12 import org.springframework.transaction.annotation.Transactional; 11 import org.springframework.transaction.annotation.Transactional;
13 import org.springframework.dao.EmptyResultDataAccessException;
14 import org.springframework.util.Assert;
15 12
16 import java.util.List; 13 import java.util.List;
17 import java.util.Objects; 14 import java.util.Objects;
...@@ -29,11 +26,15 @@ public class TaskServiceImpl implements TaskService { ...@@ -29,11 +26,15 @@ public class TaskServiceImpl implements TaskService {
29 @Autowired 26 @Autowired
30 private TaskRepository taskRepository; 27 private TaskRepository taskRepository;
31 28
32
33 @Override 29 @Override
34 public TaskDTO findById(Long id) { 30 public TaskDTO findById(Long id) {
35 Task Task = this.taskRepository.findById(id).orElseGet(Task::new); 31 Task Task = this.taskRepository.findById(id).orElseGet(Task::new);
36 ValidationUtil.isNull(Task.getId(),"Task","id",id); 32 return this.taskMapper.toDto(Task);
33 }
34
35 @Override
36 public TaskDTO findByCode(String code) {
37 Task Task = this.taskRepository.findByCode(code).orElseGet(Task::new);
37 return this.taskMapper.toDto(Task); 38 return this.taskMapper.toDto(Task);
38 } 39 }
39 40
...@@ -42,5 +43,27 @@ public class TaskServiceImpl implements TaskService { ...@@ -42,5 +43,27 @@ public class TaskServiceImpl implements TaskService {
42 return Objects.nonNull(taskTemplateId) ? this.taskRepository.findByTaskTemplateId(taskTemplateId) : null; 43 return Objects.nonNull(taskTemplateId) ? this.taskRepository.findByTaskTemplateId(taskTemplateId) : null;
43 } 44 }
44 45
46 @Override
47 public TaskDTO create(Task task) {
48 Task save = this.taskRepository.save(task);
49 return this.taskMapper.toDto(save);
50 }
51
52 @Override
53 public TaskDTO update(Task task) {
54 Task save = this.taskRepository.save(task);
55 return this.taskMapper.toDto(save);
56 }
57
58 @Override
59 public void delete(Task task) {
60 Long id = task.getId();
61 this.delete(id);
62 }
63
64 @Override
65 public void delete(Long id) {
66 this.taskRepository.updateDeleteMark(id);
67 }
45 68
46 } 69 }
......
1 package com.topdraw.business.module.task.template.domain; 1 package com.topdraw.business.module.task.template.domain;
2 2
3 import com.topdraw.business.module.common.validated.CreateGroup;
3 import lombok.Data; 4 import lombok.Data;
4 import lombok.experimental.Accessors; 5 import lombok.experimental.Accessors;
5 import cn.hutool.core.bean.BeanUtil; 6 import cn.hutool.core.bean.BeanUtil;
6 import cn.hutool.core.bean.copier.CopyOptions; 7 import cn.hutool.core.bean.copier.CopyOptions;
7 import javax.persistence.*; 8 import javax.persistence.*;
9 import javax.validation.constraints.NotNull;
10
8 import org.springframework.data.annotation.CreatedDate; 11 import org.springframework.data.annotation.CreatedDate;
9 import org.springframework.data.annotation.LastModifiedDate; 12 import org.springframework.data.annotation.LastModifiedDate;
10 import org.springframework.data.jpa.domain.support.AuditingEntityListener; 13 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...@@ -28,34 +31,40 @@ public class TaskTemplate implements Serializable { ...@@ -28,34 +31,40 @@ public class TaskTemplate implements Serializable {
28 @Column(name = "id") 31 @Column(name = "id")
29 private Long id; 32 private Long id;
30 33
31 // 标识 34 /** 标识 */
32 @Column(name = "code") 35 @Column(name = "code")
33 private String code; 36 private String code;
34 37
35 // 名称 38 /** 名称 */
36 @Column(name = "name") 39 @Column(name = "name")
37 private String name; 40 private String name;
38 41
39 // 关注事件(和MQ topic相关) 42 /** 关注事件(和MQ topic相关) */
40 @Column(name = "event") 43 @Column(name = "event")
44 @NotNull(message = "event is null", groups = {CreateGroup.class})
41 private String event; 45 private String event;
42 46
43 // 描述 47 /** 描述 */
44 @Column(name = "description") 48 @Column(name = "description")
45 private String description; 49 private String description;
46 50
47 // 状态 0:失效;1:生效 51 /** 状态 0:失效;1:生效 */
48 @Column(name = "status") 52 @Column(name = "status")
49 private Integer status; 53 private Integer status;
50 54
51 // 类型 0:活动任务模板 55 /** 类型 0:活动任务模板 */
52 @Column(name = "type") 56 @Column(name = "type")
57 @NotNull(message = "type is null", groups = {CreateGroup.class})
53 private Integer type; 58 private Integer type;
54 59
55 // 模板参数,json 60 /** 模板参数,json */
56 @Column(name = "params") 61 @Column(name = "params")
57 private String params; 62 private String params;
58 63
64 /** 删除标识 0:正常;1:已删除; */
65 @Column(name = "delete_mark")
66 private Integer deleteMark;
67
59 @CreatedDate 68 @CreatedDate
60 @Column(name = "create_time") 69 @Column(name = "create_time")
61 private Timestamp createTime; 70 private Timestamp createTime;
......
...@@ -27,7 +27,7 @@ public class TaskTemplateBuilder { ...@@ -27,7 +27,7 @@ public class TaskTemplateBuilder {
27 taskTemplate_.setEvent(taskTemplate.getEvent()); 27 taskTemplate_.setEvent(taskTemplate.getEvent());
28 taskTemplate_.setParams(taskTemplate.getParams()); 28 taskTemplate_.setParams(taskTemplate.getParams());
29 taskTemplate_.setDescription(taskTemplate.getDescription()); 29 taskTemplate_.setDescription(taskTemplate.getDescription());
30 // taskTemplate_.setDeleteMark(Objects.isNull(taskTemplate.getDeleteMark()) ? 0 : taskTemplate.getDeleteMark()); 30 taskTemplate_.setDeleteMark(Objects.isNull(taskTemplate.getDeleteMark()) ? 0 : taskTemplate.getDeleteMark());
31 31
32 return taskTemplate_; 32 return taskTemplate_;
33 } 33 }
......
...@@ -3,6 +3,9 @@ package com.topdraw.business.module.task.template.repository; ...@@ -3,6 +3,9 @@ package com.topdraw.business.module.task.template.repository;
3 import com.topdraw.business.module.task.template.domain.TaskTemplate; 3 import com.topdraw.business.module.task.template.domain.TaskTemplate;
4 import org.springframework.data.jpa.repository.JpaRepository; 4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 import org.springframework.data.jpa.repository.Modifying;
7 import org.springframework.data.jpa.repository.Query;
8 import org.springframework.transaction.annotation.Transactional;
6 9
7 import java.util.List; 10 import java.util.List;
8 import java.util.Optional; 11 import java.util.Optional;
...@@ -15,7 +18,12 @@ public interface TaskTemplateRepository extends JpaRepository<TaskTemplate, Long ...@@ -15,7 +18,12 @@ public interface TaskTemplateRepository extends JpaRepository<TaskTemplate, Long
15 18
16 Optional<TaskTemplate> findFirstByCode(String code); 19 Optional<TaskTemplate> findFirstByCode(String code);
17 20
18 TaskTemplate findByEvent(String event); 21 Optional<TaskTemplate> findByEvent(String event);
19 22
20 List<TaskTemplate> findByType(Integer event); 23 Optional<TaskTemplate> findByType(Integer event);
24
25 @Modifying
26 @Transactional
27 @Query(value = "UPDATE `tr_task_template` SET `delete_mark` = 1 , `update_time` = now() WHERE `id` = ?1", nativeQuery = true)
28 void updateDeleteMark(Long id);
21 } 29 }
......
...@@ -2,9 +2,6 @@ package com.topdraw.business.module.task.template.service; ...@@ -2,9 +2,6 @@ package com.topdraw.business.module.task.template.service;
2 2
3 import com.topdraw.business.module.task.template.domain.TaskTemplate; 3 import com.topdraw.business.module.task.template.domain.TaskTemplate;
4 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO; 4 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
5 import com.topdraw.business.module.task.template.service.dto.TaskTemplateQueryCriteria;
6 import org.springframework.data.domain.Pageable;
7 import java.util.Map;
8 import java.util.List; 5 import java.util.List;
9 6
10 /** 7 /**
...@@ -14,41 +11,54 @@ import java.util.List; ...@@ -14,41 +11,54 @@ import java.util.List;
14 public interface TaskTemplateService { 11 public interface TaskTemplateService {
15 12
16 /** 13 /**
17 * 查询数据分页
18 * @param criteria 条件参数
19 * @param pageable 分页参数
20 * @return Map<String,Object>
21 */
22 Map<String,Object> queryAll(TaskTemplateQueryCriteria criteria, Pageable pageable);
23
24 /**
25 * 查询所有数据不分页
26 * @param criteria 条件参数
27 * @return List<TaskTemplateDTO>
28 */
29 List<TaskTemplateDTO> queryAll(TaskTemplateQueryCriteria criteria);
30
31 /**
32 * 根据ID查询 14 * 根据ID查询
33 * @param id ID 15 * @param id ID
34 * @return TaskTemplateDTO 16 * @return TaskTemplateDTO
35 */ 17 */
36 TaskTemplateDTO findById(Long id); 18 TaskTemplateDTO findById(Long id);
37 19
38 void create(TaskTemplate resources); 20 /**
21 *
22 * @param resources
23 */
24 TaskTemplateDTO create(TaskTemplate resources);
39 25
40 void update(TaskTemplate resources); 26 /**
27 *
28 * @param resources
29 */
30 TaskTemplateDTO update(TaskTemplate resources);
41 31
32 /**
33 *
34 * @param id
35 */
42 void delete(Long id); 36 void delete(Long id);
43 37
44 /** 38 /**
39 *
40 * @param resources
41 */
42 void delete(TaskTemplate resources);
43
44 /**
45 * Code校验 45 * Code校验
46 * @param code 46 * @param code
47 * @return TaskTemplateDTO 47 * @return TaskTemplateDTO
48 */ 48 */
49 TaskTemplateDTO getByCode(String code); 49 TaskTemplateDTO findByCode(String code);
50 50
51 TaskTemplate findByEvent(String event); 51 /**
52 *
53 * @param event
54 * @return
55 */
56 TaskTemplateDTO findByEvent(String event);
52 57
53 List<TaskTemplate> findByType(Integer event); 58 /**
59 *
60 * @param event
61 * @return
62 */
63 TaskTemplateDTO findByType(Integer event);
54 } 64 }
......
...@@ -14,27 +14,30 @@ public class TaskTemplateDTO implements Serializable { ...@@ -14,27 +14,30 @@ public class TaskTemplateDTO implements Serializable {
14 14
15 private Long id; 15 private Long id;
16 16
17 // 标识 17 /** 标识 */
18 private String code; 18 private String code;
19 19
20 // 名称 20 /** 名称 */
21 private String name; 21 private String name;
22 22
23 // 关注事件(和MQ topic相关) 23 /** 关注事件(和MQ topic相关) */
24 private String event; 24 private String event;
25 25
26 // 描述 26 /** 描述 */
27 private String description; 27 private String description;
28 28
29 // 状态 0:失效;1:生效 29 /** 状态 0:失效;1:生效 */
30 private Integer status; 30 private Integer status;
31 31
32 // 类型 0:活动任务模板 32 /** 类型 0:活动任务模板 */
33 private Integer type; 33 private Integer type;
34 34
35 // 模板参数,json 35 /** 模板参数,json */
36 private String params; 36 private String params;
37 37
38 /** 删除标识 0:正常;1:已删除; */
39 private Integer deleteMark;
40
38 private Timestamp createTime; 41 private Timestamp createTime;
39 42
40 private Timestamp updateTime; 43 private Timestamp updateTime;
......
1 package com.topdraw.business.module.task.template.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author XiangHan
7 * @date 2021-10-22
8 */
9 @Data
10 public class TaskTemplateQueryCriteria{
11 }
1 package com.topdraw.business.module.task.template.service.impl; 1 package com.topdraw.business.module.task.template.service.impl;
2 2
3 import com.topdraw.business.module.task.template.domain.TaskTemplate; 3 import com.topdraw.business.module.task.template.domain.TaskTemplate;
4 import com.topdraw.business.module.task.template.domain.TaskTemplateBuilder;
4 import com.topdraw.utils.ValidationUtil; 5 import com.topdraw.utils.ValidationUtil;
5 import com.topdraw.business.module.task.template.repository.TaskTemplateRepository; 6 import com.topdraw.business.module.task.template.repository.TaskTemplateRepository;
6 import com.topdraw.business.module.task.template.service.TaskTemplateService; 7 import com.topdraw.business.module.task.template.service.TaskTemplateService;
7 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO; 8 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
8 import com.topdraw.business.module.task.template.service.dto.TaskTemplateQueryCriteria;
9 import com.topdraw.business.module.task.template.service.mapper.TaskTemplateMapper; 9 import com.topdraw.business.module.task.template.service.mapper.TaskTemplateMapper;
10 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation; 12 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional; 13 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.dao.EmptyResultDataAccessException; 14 import org.springframework.dao.EmptyResultDataAccessException;
15 import org.springframework.data.domain.Page;
16 import org.springframework.data.domain.Pageable;
17 import org.springframework.util.Assert; 15 import org.springframework.util.Assert;
18 import com.topdraw.utils.PageUtil;
19 import com.topdraw.utils.QueryHelp;
20 import com.topdraw.utils.StringUtils; 16 import com.topdraw.utils.StringUtils;
21 17
22 import java.util.List; 18 import java.util.List;
23 import java.util.Map;
24 import java.util.Objects; 19 import java.util.Objects;
25 20
26 /** 21 /**
...@@ -32,69 +27,60 @@ import java.util.Objects; ...@@ -32,69 +27,60 @@ import java.util.Objects;
32 public class TaskTemplateServiceImpl implements TaskTemplateService { 27 public class TaskTemplateServiceImpl implements TaskTemplateService {
33 28
34 @Autowired 29 @Autowired
35 private TaskTemplateRepository TaskTemplateRepository; 30 private TaskTemplateRepository taskTemplateRepository;
36
37 @Autowired 31 @Autowired
38 private TaskTemplateMapper TaskTemplateMapper; 32 private TaskTemplateMapper taskTemplateMapper;
39
40 @Override
41 public Map<String, Object> queryAll(TaskTemplateQueryCriteria criteria, Pageable pageable) {
42 Page<TaskTemplate> page = TaskTemplateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
43 return PageUtil.toPage(page.map(TaskTemplateMapper::toDto));
44 }
45
46 @Override
47 public List<TaskTemplateDTO> queryAll(TaskTemplateQueryCriteria criteria) {
48 return TaskTemplateMapper.toDto(TaskTemplateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
49 }
50 33
51 @Override 34 @Override
52 public TaskTemplateDTO findById(Long id) { 35 public TaskTemplateDTO findById(Long id) {
53 TaskTemplate TaskTemplate = TaskTemplateRepository.findById(id).orElseGet(TaskTemplate::new); 36 TaskTemplate TaskTemplate = this.taskTemplateRepository.findById(id).orElseGet(TaskTemplate::new);
54 ValidationUtil.isNull(TaskTemplate.getId(),"TaskTemplate","id",id); 37 ValidationUtil.isNull(TaskTemplate.getId(),"TaskTemplate","id", id);
55 return TaskTemplateMapper.toDto(TaskTemplate); 38 return this.taskTemplateMapper.toDto(TaskTemplate);
56 } 39 }
57 40
58 @Override 41 @Override
59 @Transactional(rollbackFor = Exception.class) 42 @Transactional(rollbackFor = Exception.class)
60 public void create(TaskTemplate resources) { 43 public TaskTemplateDTO create(TaskTemplate resources) {
61 TaskTemplateRepository.save(resources); 44 TaskTemplate save = this.taskTemplateRepository.save(resources);
45 return this.taskTemplateMapper.toDto(save);
62 } 46 }
63 47
64 @Override 48 @Override
65 @Transactional(rollbackFor = Exception.class) 49 @Transactional(rollbackFor = Exception.class)
66 public void update(TaskTemplate resources) { 50 public TaskTemplateDTO update(TaskTemplate resources) {
67 TaskTemplate TaskTemplate = TaskTemplateRepository.findById(resources.getId()).orElseGet(TaskTemplate::new); 51 TaskTemplate taskTemplate = this.taskTemplateRepository.findById(resources.getId()).orElseGet(TaskTemplate::new);
68 ValidationUtil.isNull( TaskTemplate.getId(),"TaskTemplate","id",resources.getId()); 52 ValidationUtil.isNull(taskTemplate.getId(),"TaskTemplate","id", resources.getId());
69 TaskTemplate.copy(resources); 53 taskTemplate.copy(resources);
70 TaskTemplateRepository.save(TaskTemplate); 54 TaskTemplate save = this.taskTemplateRepository.save(taskTemplate);
55 return this.taskTemplateMapper.toDto(save);
71 } 56 }
72 57
73 @Override 58 @Override
74 @Transactional(rollbackFor = Exception.class) 59 @Transactional(rollbackFor = Exception.class)
75 public void delete(Long id) { 60 public void delete(Long id) {
76 Assert.notNull(id, "The given id must not be null!"); 61 Assert.notNull(id, "The given id must not be null!");
77 TaskTemplate TaskTemplate = TaskTemplateRepository.findById(id).orElseThrow( 62 this.taskTemplateRepository.updateDeleteMark(id);
78 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", TaskTemplate.class, id), 1));
79 TaskTemplateRepository.delete(TaskTemplate);
80 } 63 }
81 64
65 @Override
66 public void delete(TaskTemplate resources) {
67 this.delete(resources.getId());
68 }
82 69
83 @Override 70 @Override
84 public TaskTemplateDTO getByCode(String code) { 71 public TaskTemplateDTO findByCode(String code) {
85 return StringUtils.isNotEmpty(code) ? TaskTemplateMapper.toDto(TaskTemplateRepository.findFirstByCode(code).orElseGet(TaskTemplate::new)) 72 return StringUtils.isNotEmpty(code) ? this.taskTemplateMapper.toDto(this.taskTemplateRepository.findFirstByCode(code).orElseGet(TaskTemplate::new))
86 : new TaskTemplateDTO(); 73 : new TaskTemplateDTO();
87 } 74 }
88 75
89
90 @Override 76 @Override
91 public TaskTemplate findByEvent(String event) { 77 public TaskTemplateDTO findByEvent(String event) {
92 return StringUtils.isNotEmpty(event) ? this.TaskTemplateRepository.findByEvent(event) : null; 78 return StringUtils.isNotEmpty(event) ? this.taskTemplateMapper.toDto(this.taskTemplateRepository.findByEvent(event).orElseGet(TaskTemplate::new)) : new TaskTemplateDTO();
93 } 79 }
94 80
95 // @Cacheable(cacheNames = "uc-admin_taskTemplate" , key = "#event")
96 @Override 81 @Override
97 public List<TaskTemplate> findByType(Integer event) { 82 public TaskTemplateDTO findByType(Integer event) {
98 return Objects.nonNull(event) ? this.TaskTemplateRepository.findByType(event) : null; 83 return Objects.nonNull(event) ? this.taskTemplateMapper.toDto(this.taskTemplateRepository.findByType(event).orElseGet(TaskTemplate::new)) : new TaskTemplateDTO();
99 } 84 }
85
100 } 86 }
......
...@@ -2,13 +2,11 @@ package com.topdraw.business.module.user.weixin.domain; ...@@ -2,13 +2,11 @@ package com.topdraw.business.module.user.weixin.domain;
2 2
3 import com.fasterxml.jackson.annotation.JsonFormat; 3 import com.fasterxml.jackson.annotation.JsonFormat;
4 import com.topdraw.business.module.common.domain.AsyncMqModule; 4 import com.topdraw.business.module.common.domain.AsyncMqModule;
5 import com.topdraw.business.module.common.validated.CreateGroup;
6 import lombok.Data; 5 import lombok.Data;
7 import lombok.experimental.Accessors; 6 import lombok.experimental.Accessors;
8 import cn.hutool.core.bean.BeanUtil; 7 import cn.hutool.core.bean.BeanUtil;
9 import cn.hutool.core.bean.copier.CopyOptions; 8 import cn.hutool.core.bean.copier.CopyOptions;
10 import javax.persistence.*; 9 import javax.persistence.*;
11 import javax.validation.constraints.NotNull;
12 10
13 import org.springframework.data.annotation.CreatedDate; 11 import org.springframework.data.annotation.CreatedDate;
14 import org.springframework.data.annotation.LastModifiedDate; 12 import org.springframework.data.annotation.LastModifiedDate;
......
...@@ -5,9 +5,7 @@ import lombok.Data; ...@@ -5,9 +5,7 @@ import lombok.Data;
5 import lombok.NoArgsConstructor; 5 import lombok.NoArgsConstructor;
6 6
7 import javax.persistence.Transient; 7 import javax.persistence.Transient;
8 import javax.validation.constraints.NotNull;
9 import java.sql.Timestamp; 8 import java.sql.Timestamp;
10 import java.time.LocalDateTime;
11 9
12 /** 10 /**
13 * 权益-非持久化数据 11 * 权益-非持久化数据
...@@ -51,7 +49,7 @@ public class TempRights { ...@@ -51,7 +49,7 @@ public class TempRights {
51 49
52 /** 过期时间 */ 50 /** 过期时间 */
53 @Transient 51 @Transient
54 protected LocalDateTime expireTime; 52 protected Timestamp expireTime;
55 53
56 54
57 /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */ 55 /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */
......
...@@ -22,7 +22,7 @@ public class MemberOperationBean { ...@@ -22,7 +22,7 @@ public class MemberOperationBean {
22 22
23 private Integer vip; 23 private Integer vip;
24 24
25 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 25 // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
26 private LocalDateTime vipExpireTime; 26 private Timestamp vipExpireTime;
27 27
28 } 28 }
......
...@@ -3,6 +3,7 @@ package com.topdraw.business.process.domian.weixin; ...@@ -3,6 +3,7 @@ package com.topdraw.business.process.domian.weixin;
3 import com.fasterxml.jackson.annotation.JsonFormat; 3 import com.fasterxml.jackson.annotation.JsonFormat;
4 import lombok.Data; 4 import lombok.Data;
5 5
6 import java.sql.Timestamp;
6 import java.time.LocalDateTime; 7 import java.time.LocalDateTime;
7 8
8 /** 9 /**
...@@ -15,8 +16,8 @@ public class BuyVipBean extends WeiXinUserBean { ...@@ -15,8 +16,8 @@ public class BuyVipBean extends WeiXinUserBean {
15 16
16 private Integer vip; 17 private Integer vip;
17 18
18 @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") 19 // @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
19 private LocalDateTime vipExpireTime; 20 private Timestamp vipExpireTime;
20 21
21 22
22 } 23 }
......
...@@ -41,7 +41,7 @@ public class MemberOperationController { ...@@ -41,7 +41,7 @@ public class MemberOperationController {
41 public ResultInfo updateVipByMemberId(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) { 41 public ResultInfo updateVipByMemberId(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) {
42 log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); 42 log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources);
43 Integer vip = resources.getVip(); 43 Integer vip = resources.getVip();
44 LocalDateTime vipExpireTime = resources.getVipExpireTime(); 44 Timestamp vipExpireTime = resources.getVipExpireTime();
45 Long memberId = resources.getMemberId(); 45 Long memberId = resources.getMemberId();
46 MemberDTO memberDTO = this.memberOperationService.findById(memberId); 46 MemberDTO memberDTO = this.memberOperationService.findById(memberId);
47 47
......
1 package com.topdraw.business.process.rest; 1 package com.topdraw.business.process.rest;
2 2
3 import com.topdraw.annotation.AnonymousAccess; 3 import com.topdraw.annotation.AnonymousAccess;
4 import com.topdraw.business.module.common.validated.CreateGroup;
5 import com.topdraw.business.module.task.domain.Task;
6 import com.topdraw.business.module.task.service.dto.TaskDTO;
4 import com.topdraw.business.process.domian.TempIptvUser; 7 import com.topdraw.business.process.domian.TempIptvUser;
5 import com.topdraw.business.process.service.TaskOperationService; 8 import com.topdraw.business.process.service.TaskOperationService;
6 import com.topdraw.business.process.service.dto.TaskOperationQueryCriteria; 9 import com.topdraw.business.process.service.dto.TaskOperationQueryCriteria;
7 import com.topdraw.common.ResultInfo; 10 import com.topdraw.common.ResultInfo;
8 import io.swagger.annotations.Api; 11 import io.swagger.annotations.Api;
9 import io.swagger.annotations.ApiOperation; 12 import io.swagger.annotations.ApiOperation;
13 import lombok.extern.slf4j.Slf4j;
14 import org.springframework.beans.BeanUtils;
10 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.validation.annotation.Validated; 16 import org.springframework.validation.annotation.Validated;
12 import org.springframework.web.bind.annotation.*; 17 import org.springframework.web.bind.annotation.*;
13 18
14 import java.util.Arrays; 19 import java.util.Arrays;
20 import java.util.Objects;
15 21
16 @Api("任务处理") 22 @Api("任务处理")
17 @RestController 23 @RestController
18 @RequestMapping(value = "/uce/taskOperation") 24 @RequestMapping(value = "/uce/taskOperation")
25 @Slf4j
19 public class TaskOperationController { 26 public class TaskOperationController {
20 27
21 @Autowired 28 @Autowired
22 TaskOperationService taskOperationService; 29 private TaskOperationService taskOperationService;
23 30
24 /** 31 /**
25 * 处理事件 32 * 处理事件
...@@ -34,7 +41,63 @@ public class TaskOperationController { ...@@ -34,7 +41,63 @@ public class TaskOperationController {
34 this.taskOperationService.dealTask(criteria.getContent()); 41 this.taskOperationService.dealTask(criteria.getContent());
35 } 42 }
36 43
44 /**
45 * 新增任务
46 *
47 * @param task 消息
48 */
49 @PostMapping(value = "/createTask")
50 @ApiOperation("新增任务")
51 @AnonymousAccess
52 public void createTask(@RequestBody @Validated(value = {CreateGroup.class}) Task task) {
53 log.info("taskOperation ==>> createTask ==>> param ==>> {}", task);
54
55 String code = task.getCode();
56 TaskDTO taskDTO = this.taskOperationService.findByCode(code);
57 if (Objects.isNull(taskDTO.getId())) {
58 // 新增任务
59 this.taskOperationService.createTask(task);
60 }
37 61
62 }
63
64 /**
65 * 修改任务
66 *
67 * @param task 消息
68 */
69 @PostMapping(value = "/updateTask")
70 @ApiOperation("修改任务")
71 @AnonymousAccess
72 public void updateTask(@RequestBody @Validated Task task) {
73 log.info("taskOperation ==>> updateTask ==>> param ==>> {}", task);
74 Long id = task.getId();
75 TaskDTO taskDTO = this.taskOperationService.findById(id);
76 if (Objects.nonNull(taskDTO.getId())) {
77 task.setCode(taskDTO.getCode());
78 Task task_ = new Task();
79 BeanUtils.copyProperties(taskDTO, task_);
80 task_.copy(task);
81 // 修改任务
82 this.taskOperationService.updateTask(task_);
83 }
84 }
85
86 /**
87 * 删除任务
88 *
89 * @param task 消息
90 */
91 @PostMapping(value = "/deleteTask")
92 @ApiOperation("删除任务")
93 @AnonymousAccess
94 public void deleteTask(@RequestBody @Validated Task task) {
95 log.info("taskOperation ==>> deleteTask ==>> param ==>> {}", task);
96
97 Long id = task.getId();
98 // 删除任务
99 this.taskOperationService.deleteTask(id);
100 }
38 101
39 /** 102 /**
40 * 针对重庆20211220号的积分兑换活动专门定制的接口 103 * 针对重庆20211220号的积分兑换活动专门定制的接口
......
...@@ -2,6 +2,7 @@ package com.topdraw.business.process.rest; ...@@ -2,6 +2,7 @@ package com.topdraw.business.process.rest;
2 2
3 import com.topdraw.annotation.AnonymousAccess; 3 import com.topdraw.annotation.AnonymousAccess;
4 import com.topdraw.business.module.task.template.domain.TaskTemplate; 4 import com.topdraw.business.module.task.template.domain.TaskTemplate;
5 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
5 import com.topdraw.business.process.service.TaskTemplateOperationService; 6 import com.topdraw.business.process.service.TaskTemplateOperationService;
6 import io.swagger.annotations.Api; 7 import io.swagger.annotations.Api;
7 import io.swagger.annotations.ApiOperation; 8 import io.swagger.annotations.ApiOperation;
...@@ -10,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.validation.annotation.Validated; 11 import org.springframework.validation.annotation.Validated;
11 import org.springframework.web.bind.annotation.*; 12 import org.springframework.web.bind.annotation.*;
12 13
14 import java.util.Objects;
15
13 @Api("任务模板处理") 16 @Api("任务模板处理")
14 @RestController 17 @RestController
15 @RequestMapping(value = "/uce/taskTemplateOperation") 18 @RequestMapping(value = "/uce/taskTemplateOperation")
...@@ -29,8 +32,15 @@ public class TaskTemplateOperationController { ...@@ -29,8 +32,15 @@ public class TaskTemplateOperationController {
29 @AnonymousAccess 32 @AnonymousAccess
30 public void create(@RequestBody @Validated TaskTemplate taskTemplate) { 33 public void create(@RequestBody @Validated TaskTemplate taskTemplate) {
31 log.info("taskTemplateOperation ==>> create ==>> param ==>> {}", taskTemplate); 34 log.info("taskTemplateOperation ==>> create ==>> param ==>> {}", taskTemplate);
32 // 新增任务 35 String code = taskTemplate.getCode();
33 this.taskTemplateOperationService.create(taskTemplate); 36 Integer type = taskTemplate.getType();
37 TaskTemplateDTO taskTemplateDTO_ = this.taskTemplateOperationService.findByCode(code);
38 TaskTemplateDTO taskTemplateDTO_1 = this.taskTemplateOperationService.findByType(type);
39 if (Objects.isNull(taskTemplateDTO_.getId()) && Objects.isNull(taskTemplateDTO_1.getId())) {
40 // 新增任务
41 this.taskTemplateOperationService.create(taskTemplate);
42 }
43
34 } 44 }
35 45
36 /** 46 /**
...@@ -50,13 +60,15 @@ public class TaskTemplateOperationController { ...@@ -50,13 +60,15 @@ public class TaskTemplateOperationController {
50 /** 60 /**
51 * 删除任务 61 * 删除任务
52 * 62 *
53 * @param id 消息 63 * @param taskTemplate 消息
54 */ 64 */
55 @PostMapping(value = "/delete") 65 @PostMapping(value = "/delete")
56 @ApiOperation("删除任务模板") 66 @ApiOperation("删除任务模板")
57 @AnonymousAccess 67 @AnonymousAccess
58 public void delete(@RequestParam(value = "id") Long id) { 68 public void delete(@RequestBody @Validated TaskTemplate taskTemplate) {
59 log.info("taskTemplateOperation ==>> delete ==>> param ==>> {}", id); 69 log.info("taskTemplateOperation ==>> delete ==>> param ==>> {}", taskTemplate);
70
71 Long id = taskTemplate.getId();
60 // 删除任务 72 // 删除任务
61 this.taskTemplateOperationService.delete(id); 73 this.taskTemplateOperationService.delete(id);
62 } 74 }
......
1 package com.topdraw.business.process.service; 1 package com.topdraw.business.process.service;
2 2
3 import com.topdraw.business.module.task.domain.Task;
4 import com.topdraw.business.module.task.service.dto.TaskDTO;
3 import com.topdraw.common.ResultInfo; 5 import com.topdraw.common.ResultInfo;
4 6
5 /** 7 /**
...@@ -9,6 +11,10 @@ import com.topdraw.common.ResultInfo; ...@@ -9,6 +11,10 @@ import com.topdraw.common.ResultInfo;
9 */ 11 */
10 public interface TaskOperationService { 12 public interface TaskOperationService {
11 13
14 TaskDTO findById(Long id);
15
16 TaskDTO findByCode(String code);
17
12 /** 18 /**
13 * 处理任务 19 * 处理任务
14 * 20 *
...@@ -18,9 +24,36 @@ public interface TaskOperationService { ...@@ -18,9 +24,36 @@ public interface TaskOperationService {
18 24
19 /** 25 /**
20 * 26 *
27 * @param task
28 */
29 void createTask(Task task);
30
31 /**
32 *
33 * @param task
34 */
35 void updateTask(Task task);
36
37 /**
38 *
39 * @param task
40 */
41 void deleteTask(Task task);
42
43 /**
44 *
45 * @param id
46 */
47 void deleteTask(Long id);
48
49 /**
50 *
21 * @param platformAccount 51 * @param platformAccount
22 * @param points 52 * @param points
23 * @return 53 * @return
24 */ 54 */
25 boolean createPoint2ChongQing(String platformAccount, Long points); 55 boolean createPoint2ChongQing(String platformAccount, Long points);
56
57
58
26 } 59 }
......
1 package com.topdraw.business.process.service; 1 package com.topdraw.business.process.service;
2 2
3 import com.topdraw.business.module.task.template.domain.TaskTemplate; 3 import com.topdraw.business.module.task.template.domain.TaskTemplate;
4 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
4 5
5 /** 6 /**
6 * @description 权益操作接口 7 * @description 权益操作接口
...@@ -33,4 +34,31 @@ public interface TaskTemplateOperationService { ...@@ -33,4 +34,31 @@ public interface TaskTemplateOperationService {
33 */ 34 */
34 void delete(Long id); 35 void delete(Long id);
35 36
37 /**
38 *
39 * @param code
40 * @return
41 */
42 TaskTemplateDTO findByCode(String code);
43
44 /**
45 *
46 * @param id
47 * @return
48 */
49 TaskTemplateDTO findById(Long id);
50
51 /**
52 *
53 * @param event
54 * @return
55 */
56 TaskTemplateDTO findByEvent(String event);
57
58 /**
59 *
60 * @param event
61 * @return
62 */
63 TaskTemplateDTO findByType(Integer event);
36 } 64 }
......
...@@ -206,7 +206,7 @@ public class CouponOperationServiceImpl implements CouponOperationService { ...@@ -206,7 +206,7 @@ public class CouponOperationServiceImpl implements CouponOperationService {
206 couponHistory.setMemberCode(tempCoupon.getMemberCode()); 206 couponHistory.setMemberCode(tempCoupon.getMemberCode());
207 couponHistory.setUserNickname(tempCoupon.getUserNickname()); 207 couponHistory.setUserNickname(tempCoupon.getUserNickname());
208 couponHistory.setOrderDetailId(tempCoupon.getOrderId()); 208 couponHistory.setOrderDetailId(tempCoupon.getOrderId());
209 couponHistory.setReceiveTime(LocalDateTime.now()); 209 couponHistory.setReceiveTime(TimestampUtil.now());
210 couponHistory.setUseStatus(Objects.nonNull(couponHistory.getUseStatus()) ? couponHistory.getUseStatus():0); 210 couponHistory.setUseStatus(Objects.nonNull(couponHistory.getUseStatus()) ? couponHistory.getUseStatus():0);
211 this.couponHistoryService.create(couponHistory); 211 this.couponHistoryService.create(couponHistory);
212 212
......
...@@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Propagation;
35 import org.springframework.transaction.annotation.Transactional; 35 import org.springframework.transaction.annotation.Transactional;
36 import org.springframework.util.CollectionUtils; 36 import org.springframework.util.CollectionUtils;
37 37
38 import java.sql.Timestamp;
38 import java.time.LocalDateTime; 39 import java.time.LocalDateTime;
39 import java.util.*; 40 import java.util.*;
40 import java.util.concurrent.TimeUnit; 41 import java.util.concurrent.TimeUnit;
...@@ -95,7 +96,10 @@ public class PointsOperationServiceImpl implements PointsOperationService { ...@@ -95,7 +96,10 @@ public class PointsOperationServiceImpl implements PointsOperationService {
95 @Override 96 @Override
96 public void grantPointsByManualByTempPoints(TempPoints tempPoints) { 97 public void grantPointsByManualByTempPoints(TempPoints tempPoints) {
97 if (Objects.nonNull(tempPoints) && Objects.nonNull(tempPoints.getPoints())) { 98 if (Objects.nonNull(tempPoints) && Objects.nonNull(tempPoints.getPoints())) {
98 tempPoints.setExpireTime(DateUtil.getLastDateTimeSecondYear()); 99 Timestamp expireTime = tempPoints.getExpireTime();
100 if (Objects.isNull(expireTime)){
101 tempPoints.setExpireTime(TimestampUtil.localDateTime2Timestamp(DateUtil.getLastDateTimeSecondYear()));
102 }
99 this.refresh(tempPoints); 103 this.refresh(tempPoints);
100 } 104 }
101 } 105 }
...@@ -329,7 +333,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { ...@@ -329,7 +333,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
329 private void cleanInvalidAvailablePointsByMemberId(Long memberId) { 333 private void cleanInvalidAvailablePointsByMemberId(Long memberId) {
330 334
331 List<PointsAvailableDTO> pointsAvailableDTOS = 335 List<PointsAvailableDTO> pointsAvailableDTOS =
332 pointsAvailableService.findByMemberIdAndExpireTimeBefore(memberId,LocalDateTime.now()); 336 pointsAvailableService.findByMemberIdAndExpireTimeBefore(memberId, TimestampUtil.now());
333 337
334 if (!CollectionUtils.isEmpty(pointsAvailableDTOS)) { 338 if (!CollectionUtils.isEmpty(pointsAvailableDTOS)) {
335 339
...@@ -555,7 +559,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { ...@@ -555,7 +559,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
555 String description = pointsAvailable.getDescription(); 559 String description = pointsAvailable.getDescription();
556 pointsAvailable.setCode(String.valueOf(IdWorker.generator())); 560 pointsAvailable.setCode(String.valueOf(IdWorker.generator()));
557 pointsAvailable.setDescription(StringUtils.isEmpty(description)?"#":description); 561 pointsAvailable.setDescription(StringUtils.isEmpty(description)?"#":description);
558 LocalDateTime timestamp = tempPoints.getExpireTime(); 562 Timestamp timestamp = tempPoints.getExpireTime();
559 if (Objects.nonNull(timestamp)) { 563 if (Objects.nonNull(timestamp)) {
560 pointsAvailable.setExpireTime(timestamp); 564 pointsAvailable.setExpireTime(timestamp);
561 } 565 }
......
...@@ -21,8 +21,8 @@ import org.springframework.stereotype.Service; ...@@ -21,8 +21,8 @@ import org.springframework.stereotype.Service;
21 import org.springframework.util.CollectionUtils; 21 import org.springframework.util.CollectionUtils;
22 import org.springframework.util.StringUtils; 22 import org.springframework.util.StringUtils;
23 23
24 import java.sql.Timestamp;
24 import java.util.*; 25 import java.util.*;
25 import java.util.concurrent.*;
26 26
27 /** 27 /**
28 * 权益处理 28 * 权益处理
...@@ -230,7 +230,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { ...@@ -230,7 +230,7 @@ public class RightsOperationServiceImpl implements RightsOperationService {
230 RightsDTO rightsDTO = this.getRights(rightId); 230 RightsDTO rightsDTO = this.getRights(rightId);
231 // 权益的实体类型 1:积分;2成长值;3优惠券 231 // 权益的实体类型 1:积分;2成长值;3优惠券
232 String type = rightsDTO.getEntityType(); 232 String type = rightsDTO.getEntityType();
233 Long expireTime = rightsDTO.getExpireTime(); 233 Timestamp expireTime = rightsDTO.getExpireTime();
234 234
235 switch (type) { 235 switch (type) {
236 // 优惠券 236 // 优惠券
...@@ -246,7 +246,8 @@ public class RightsOperationServiceImpl implements RightsOperationService { ...@@ -246,7 +246,8 @@ public class RightsOperationServiceImpl implements RightsOperationService {
246 tempCoupon.setRightsSendStrategy(0); 246 tempCoupon.setRightsSendStrategy(0);
247 tempCoupon.setCode(couponDTO.getCode()); 247 tempCoupon.setCode(couponDTO.getCode());
248 if (Objects.nonNull(expireTime)) 248 if (Objects.nonNull(expireTime))
249 tempCoupon.setExpireTime(TimestampUtil.long2LocalDateTime(expireTime)); 249 // tempCoupon.setExpireTime(TimestampUtil.long2LocalDateTime(expireTime));
250 tempCoupon.setExpireTime(expireTime);
250 tempCouponList.add(tempCoupon); 251 tempCouponList.add(tempCoupon);
251 } 252 }
252 break; 253 break;
......
...@@ -3,20 +3,22 @@ package com.topdraw.business.process.service.impl; ...@@ -3,20 +3,22 @@ package com.topdraw.business.process.service.impl;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
5 import com.alibaba.fastjson.JSONObject; 5 import com.alibaba.fastjson.JSONObject;
6 import com.google.gson.JsonObject; 6 import com.topdraw.aspect.AsyncMqSend;
7 import com.topdraw.business.module.coupon.service.CouponService; 7 import com.topdraw.business.module.coupon.service.CouponService;
8 import com.topdraw.business.module.coupon.service.dto.CouponDTO; 8 import com.topdraw.business.module.coupon.service.dto.CouponDTO;
9 import com.topdraw.business.module.member.group.service.MemberGroupService; 9 import com.topdraw.business.module.member.group.service.MemberGroupService;
10 import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; 10 import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO;
11 import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService;
12 import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO;
13 import com.topdraw.business.module.rights.service.RightsService; 11 import com.topdraw.business.module.rights.service.RightsService;
14 import com.topdraw.business.module.rights.service.dto.RightsDTO; 12 import com.topdraw.business.module.rights.service.dto.RightsDTO;
13 import com.topdraw.business.module.task.attribute.domain.TaskAttr;
15 import com.topdraw.business.module.task.attribute.service.TaskAttrService; 14 import com.topdraw.business.module.task.attribute.service.TaskAttrService;
16 import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; 15 import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO;
16 import com.topdraw.business.module.task.domain.TaskBuilder;
17 import com.topdraw.business.module.task.progress.domain.TrTaskProgress; 17 import com.topdraw.business.module.task.progress.domain.TrTaskProgress;
18 import com.topdraw.business.module.task.progress.service.TrTaskProgressService; 18 import com.topdraw.business.module.task.progress.service.TrTaskProgressService;
19 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; 19 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO;
20 import com.topdraw.business.module.task.service.dto.TaskDTO;
21 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
20 import com.topdraw.business.module.user.iptv.domain.UserTv; 22 import com.topdraw.business.module.user.iptv.domain.UserTv;
21 import com.topdraw.business.module.user.iptv.service.UserTvService; 23 import com.topdraw.business.module.user.iptv.service.UserTvService;
22 import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; 24 import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
...@@ -38,13 +40,14 @@ import com.topdraw.exception.BadRequestException; ...@@ -38,13 +40,14 @@ import com.topdraw.exception.BadRequestException;
38 import com.topdraw.module.mq.DataSyncMsg; 40 import com.topdraw.module.mq.DataSyncMsg;
39 import com.topdraw.util.*; 41 import com.topdraw.util.*;
40 import lombok.extern.slf4j.Slf4j; 42 import lombok.extern.slf4j.Slf4j;
43 import org.apache.commons.lang3.StringUtils;
44 import org.springframework.aop.framework.AopContext;
41 import org.springframework.beans.BeanUtils; 45 import org.springframework.beans.BeanUtils;
42 import org.springframework.beans.factory.annotation.Autowired; 46 import org.springframework.beans.factory.annotation.Autowired;
43 import org.springframework.data.redis.core.StringRedisTemplate; 47 import org.springframework.data.redis.core.StringRedisTemplate;
44 import org.springframework.data.redis.core.ValueOperations; 48 import org.springframework.data.redis.core.ValueOperations;
45 import org.springframework.stereotype.Service; 49 import org.springframework.stereotype.Service;
46 import org.springframework.util.CollectionUtils; 50 import org.springframework.util.CollectionUtils;
47 import org.springframework.util.StringUtils;
48 51
49 import javax.validation.constraints.NotNull; 52 import javax.validation.constraints.NotNull;
50 import java.sql.Timestamp; 53 import java.sql.Timestamp;
...@@ -65,27 +68,27 @@ import static java.util.stream.Collectors.toList; ...@@ -65,27 +68,27 @@ import static java.util.stream.Collectors.toList;
65 @Slf4j 68 @Slf4j
66 public class TaskOperationServiceImpl implements TaskOperationService { 69 public class TaskOperationServiceImpl implements TaskOperationService {
67 70
71
68 @Autowired 72 @Autowired
69 private TaskService taskService; 73 private TaskService taskService;
70 @Autowired 74 @Autowired
75 private UserTvService userTvService;
76 @Autowired
71 private MemberService memberService; 77 private MemberService memberService;
72 @Autowired 78 @Autowired
73 private RightsService rightsService; 79 private RightsService rightsService;
74 @Autowired 80 @Autowired
75 private TaskTemplateService taskTemplateService;
76 @Autowired
77 private RightsOperationService rightsOperationService;
78 @Autowired
79 private TrTaskProgressService trTaskProgressService;
80 @Autowired
81 private CouponService couponService; 81 private CouponService couponService;
82 @Autowired 82 @Autowired
83 private TaskAttrService taskAttrService;
84 @Autowired
83 private MemberGroupService memberGroupService; 85 private MemberGroupService memberGroupService;
84 @Autowired 86 @Autowired
85 private TaskAttrService taskAttrService; 87 private TaskTemplateService taskTemplateService;
86 @Autowired 88 @Autowired
87 private UserTvService userTvService; 89 private TrTaskProgressService trTaskProgressService;
88 90 @Autowired
91 private RightsOperationService rightsOperationService;
89 92
90 private static final Integer TASK_FINISH_STATUS = 1; 93 private static final Integer TASK_FINISH_STATUS = 1;
91 private static final Integer TASK_UNFINISH_STATUS = 2; 94 private static final Integer TASK_UNFINISH_STATUS = 2;
...@@ -93,6 +96,118 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -93,6 +96,118 @@ public class TaskOperationServiceImpl implements TaskOperationService {
93 private static final Integer POINTS_MIN = 1; 96 private static final Integer POINTS_MIN = 1;
94 97
95 98
99 @AsyncMqSend
100 public void asyncCreateTask(Task task) {}
101 @AsyncMqSend
102 public void asyncUpdateTask(Task task) {}
103 @AsyncMqSend
104 public void asyncDeleteTask(Task task) {}
105
106 @Override
107 public void createTask(Task task) {
108 Long taskTemplateId = task.getTaskTemplateId();
109 TaskTemplateDTO taskTemplateDTO = this.findByTemplateId(taskTemplateId);
110
111 task.setTaskTemplateCode(taskTemplateDTO.getCode());
112 Task task_ = TaskBuilder.build(task);
113 TaskDTO taskDTO = this.taskService.create(task_);
114 if (Objects.nonNull(taskDTO.getId())) {
115 task_.setId(taskDTO.getId());
116 this.createTaskAttr(task_);
117 }
118
119 ((TaskOperationServiceImpl) AopContext.currentProxy()).asyncCreateTask(task_);
120 }
121
122 /**
123 *
124 * @param taskTemplateId
125 * @return
126 */
127 private TaskTemplateDTO findByTemplateId(Long taskTemplateId){
128 return this.taskTemplateService.findById(taskTemplateId);
129 }
130
131 /**
132 *
133 * @param task_
134 */
135 private void createTaskAttr(Task task_) {
136 TaskAttr taskAttr = new TaskAttr();
137 taskAttr.setAttrStr(task_.getAttr());
138 taskAttr.setTaskId(task_.getId());
139 this.taskAttrService.create(taskAttr);
140 }
141
142 @Override
143 public void updateTask(Task task) {
144 Long taskTemplateId = task.getTaskTemplateId();
145 TaskTemplateDTO taskTemplateDTO = this.findByTemplateId(taskTemplateId);
146 task.setTaskTemplateCode(taskTemplateDTO.getCode());
147 TaskDTO update = this.taskService.update(task);
148 if (Objects.nonNull(update.getId())) {
149 this.updateTaskAttr(task);
150 }
151
152 ((TaskOperationServiceImpl) AopContext.currentProxy()).asyncUpdateTask(task);
153 }
154
155 /**
156 *
157 * @param task_
158 */
159 private void updateTaskAttr(Task task_) {
160
161 TaskAttrDTO taskAttrDTO = this.findTaskAttrByTaskId(task_.getId());
162 if (Objects.nonNull(taskAttrDTO.getId())) {
163 TaskAttr taskAttr = new TaskAttr();
164 BeanUtils.copyProperties(taskAttrDTO, taskAttr);
165 taskAttr.setAttrStr(task_.getAttr());
166 this.taskAttrService.update(taskAttr);
167 }
168 }
169
170 @Override
171 public void deleteTask(Task task) {
172 Long id = task.getId();
173 TaskDTO taskDTO = this.findById(id);
174 if (Objects.nonNull(taskDTO.getId())) {
175 task.setId(taskDTO.getId());
176 this.taskService.delete(task);
177 task.setCode(taskDTO.getCode());
178 ((TaskOperationServiceImpl) AopContext.currentProxy()).asyncDeleteTask(task);
179 }
180 }
181
182 @Override
183 public void deleteTask(Long id) {
184 TaskDTO taskDTO = this.findById(id);
185 if (Objects.nonNull(taskDTO.getId())) {
186 Task task = new Task();
187 task.setId(taskDTO.getId());
188 task.setCode(taskDTO.getCode());
189 this.deleteTask(task);
190 }
191 }
192
193 @Override
194 public TaskDTO findById(Long id) {
195 TaskDTO taskDTO = this.taskService.findById(id);
196 Long id1 = taskDTO.getId();
197 TaskAttrDTO taskAttrDTO = this.taskAttrService.findByTaskId(id1);
198 if (Objects.nonNull(taskAttrDTO.getId())) {
199 String attrStr = taskAttrDTO.getAttrStr();
200 taskDTO.setAttr(attrStr);
201 }
202 return taskDTO;
203 }
204
205 @Override
206 public TaskDTO findByCode(String code) {
207 TaskDTO taskDTO = this.taskService.findByCode(code);
208 return taskDTO;
209 }
210
96 @Override 211 @Override
97 public ResultInfo dealTask(String content) { 212 public ResultInfo dealTask(String content) {
98 213
...@@ -101,7 +216,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -101,7 +216,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
101 Integer event = msgData.getEvent(); 216 Integer event = msgData.getEvent();
102 String memberCode = msgData.getMemberCode(); 217 String memberCode = msgData.getMemberCode();
103 Long memberId = msgData.getMemberId(); 218 Long memberId = msgData.getMemberId();
104 if (StringUtils.hasText(memberCode)) { 219 if (StringUtils.isNotBlank(memberCode)) {
105 MemberDTO memberDTO = this.memberService.findByCode(memberCode); 220 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
106 memberId = memberDTO.getId(); 221 memberId = memberDTO.getId();
107 } 222 }
...@@ -109,7 +224,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -109,7 +224,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
109 // 检查当前会员的黑名单状态 224 // 检查当前会员的黑名单状态
110 boolean b = this.validatedMemberBlackStatus(memberId); 225 boolean b = this.validatedMemberBlackStatus(memberId);
111 if (!b) { 226 if (!b) {
112 return ResultInfo.forbidden(" 会员已被加入黑名单"); 227 return ResultInfo.forbidden("会员已被加入黑名单");
113 } 228 }
114 229
115 // 1.通过任务标识获取任务模板,通过模板参数获取具体的模板 230 // 1.通过任务标识获取任务模板,通过模板参数获取具体的模板
...@@ -136,6 +251,8 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -136,6 +251,8 @@ public class TaskOperationServiceImpl implements TaskOperationService {
136 251
137 } 252 }
138 253
254
255
139 /** 256 /**
140 * 风控检查 257 * 风控检查
141 * @param memberId 258 * @param memberId
...@@ -156,7 +273,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -156,7 +273,6 @@ public class TaskOperationServiceImpl implements TaskOperationService {
156 log.info("validatedMember -->>【memberId】 -->> " + memberId); 273 log.info("validatedMember -->>【memberId】 -->> " + memberId);
157 MemberDTO memberDTO = this.memberService.findById(memberId); 274 MemberDTO memberDTO = this.memberService.findById(memberId);
158 Long blackStatus = memberDTO.getBlackStatus(); 275 Long blackStatus = memberDTO.getBlackStatus();
159 // TODO 检查balckStatus无法获取的原因
160 if (Objects.nonNull(blackStatus) && blackStatus == 1) { 276 if (Objects.nonNull(blackStatus) && blackStatus == 1) {
161 log.error("validatedMember -->> 会员已被加入黑名单 【blackStatus】 -->> " + blackStatus); 277 log.error("validatedMember -->> 会员已被加入黑名单 【blackStatus】 -->> " + blackStatus);
162 return false; 278 return false;
...@@ -216,78 +332,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -216,78 +332,6 @@ public class TaskOperationServiceImpl implements TaskOperationService {
216 332
217 } 333 }
218 334
219 private Long getIptvPriorityMemberId(Long memberId1,DataSyncMsg.MsgData msgData) {
220
221 //
222 if (Objects.nonNull(memberId1)) {
223 return memberId1;
224 }
225
226
227 @NotNull Integer deviceType = msgData.getDeviceType();
228 Long userId = msgData.getUserId();
229 // 大屏
230 if (Objects.nonNull(userId) || deviceType == 1) {
231
232 }
233
234 MemberDTO memberDTO = this.findMemberById(memberId1);
235 if (Objects.nonNull(memberDTO.getId())) {
236 Long userIptvId = memberDTO.getUserIptvId();
237 // 绑定了大屏,直接返回小屏会员id
238 if (Objects.nonNull(userIptvId)) {
239 return memberDTO.getId();
240 } else {
241 //
242 }
243 }
244 return null;
245 }
246
247 /**
248 * 验证是否满足永久权益
249 * @param permanentRights
250 * @param memberId
251 * @return
252 */
253 private boolean validatedPermanentRights(PermanentRightsDTO permanentRights, Long memberId){
254 // 永久权益类型 0:vip;1:会员等级
255 Integer type = 0;
256 // 等级(当权益类型为vip时,对应vip值,当权益类型为会员等级时,对应等级index)
257 Integer level = 0;
258 if (Objects.nonNull(permanentRights)) {
259 level = permanentRights.getLevel();
260 type = permanentRights.getType();
261 }
262
263 boolean result = false;
264
265 MemberDTO memberDTO = this.memberService.findById(memberId);
266 if (Objects.nonNull(memberDTO)) {
267 // 会员vip等级
268 Integer memberVip = memberDTO.getVip();
269 // 会员等级
270 Integer memberLevel = memberDTO.getLevel();
271 switch (type) {
272 // vip等级
273 case 0:
274 if ((Objects.isNull(memberVip) ? 0 : memberVip) >= level)
275 result = true;
276 break;
277 // 会员等级
278 case 1:
279 if ((Objects.isNull(memberLevel) ? 0 : memberLevel) >= level)
280 result = true;
281 break;
282
283 default:
284 break;
285 }
286 }
287
288 return result;
289 }
290
291 /** 335 /**
292 * 创建权益 336 * 创建权益
293 * @param memberId 337 * @param memberId
...@@ -301,9 +345,9 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -301,9 +345,9 @@ public class TaskOperationServiceImpl implements TaskOperationService {
301 tempRights.setMemberId(memberId); 345 tempRights.setMemberId(memberId);
302 tempRights.setMemberCode(memberCode); 346 tempRights.setMemberCode(memberCode);
303 tempRights.setRightsAmount(rightsAmount); 347 tempRights.setRightsAmount(rightsAmount);
304 Long expireTime = rightsDTO.getExpireTime(); 348 Timestamp expireTime = rightsDTO.getExpireTime();
305 if (Objects.nonNull(expireTime)) 349 if (Objects.nonNull(expireTime))
306 tempRights.setExpireTime(TimestampUtil.long2LocalDateTime(expireTime)); 350 tempRights.setExpireTime(expireTime);
307 return tempRights; 351 return tempRights;
308 } 352 }
309 353
...@@ -485,7 +529,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -485,7 +529,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
485 Long rewardPoints = task.getRewardPoints(); 529 Long rewardPoints = task.getRewardPoints();
486 // 过期时间 530 // 过期时间
487 Long rewardPointsExpireTime = task.getRewardPointsExpireTime(); 531 Long rewardPointsExpireTime = task.getRewardPointsExpireTime();
488 LocalDateTime expireTime = task.getExpireTime(); 532 Timestamp expireTime = task.getExpireTime();
489 // 积分类型(0:定值、1:随机) 533 // 积分类型(0:定值、1:随机)
490 Integer pointsType = task.getPointsType(); 534 Integer pointsType = task.getPointsType();
491 // 随机积分的最大值 535 // 随机积分的最大值
...@@ -544,7 +588,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -544,7 +588,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
544 588
545 List<Task> taskStream = taskList1.stream().filter(task1 -> 589 List<Task> taskStream = taskList1.stream().filter(task1 ->
546 task1.getStatus() == 1 && 590 task1.getStatus() == 1 &&
547 (Objects.isNull(task1.getExpireTime()) || task1.getExpireTime().compareTo(LocalDateTime.now()) >= 0) && 591 (Objects.isNull(task1.getExpireTime()) || task1.getExpireTime().compareTo(TimestampUtil.now()) >= 0) &&
548 (Objects.isNull(task1.getValidTime()) || task1.getValidTime().compareTo(TimestampUtil.now()) <= 0) && 592 (Objects.isNull(task1.getValidTime()) || task1.getValidTime().compareTo(TimestampUtil.now()) <= 0) &&
549 (Objects.isNull(task1.getMemberLevel()) || task1.getMemberLevel() <= memberDTO1.getLevel()) && 593 (Objects.isNull(task1.getMemberLevel()) || task1.getMemberLevel() <= memberDTO1.getLevel()) &&
550 (Objects.isNull(task1.getMemberVip()) || task1.getMemberVip() <= memberDTO1.getVip()) 594 (Objects.isNull(task1.getMemberVip()) || task1.getMemberVip() <= memberDTO1.getVip())
...@@ -868,7 +912,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -868,7 +912,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
868 continue; 912 continue;
869 913
870 String attrStr = taskAttrDTO.getAttrStr(); 914 String attrStr = taskAttrDTO.getAttrStr();
871 if (StringUtils.hasText(attrStr)) { 915 if (StringUtils.isNotBlank(attrStr)) {
872 JSONObject jsonObject = JSONObject.parseObject(attrStr); 916 JSONObject jsonObject = JSONObject.parseObject(attrStr);
873 JSONArray values_0 = jsonObject.getJSONArray("value"); 917 JSONArray values_0 = jsonObject.getJSONArray("value");
874 918
...@@ -977,11 +1021,13 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -977,11 +1021,13 @@ public class TaskOperationServiceImpl implements TaskOperationService {
977 1021
978 } else { 1022 } else {
979 1023
980 List<TaskTemplate> taskTemplateList = this.taskTemplateService.findByType(event); 1024 TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findByType(event);
981 1025
982 if (!CollectionUtils.isEmpty(taskTemplateList)) { 1026 if (Objects.nonNull(taskTemplateDTO)) {
983 1027
984 return taskTemplateList.get(0); 1028 TaskTemplate taskTemplate = new TaskTemplate();
1029 BeanUtils.copyProperties(taskTemplateDTO, taskTemplate);
1030 return taskTemplate;
985 1031
986 } else { 1032 } else {
987 1033
...@@ -994,28 +1040,26 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -994,28 +1040,26 @@ public class TaskOperationServiceImpl implements TaskOperationService {
994 1040
995 private TaskTemplate findByTypeAndParam(Integer event, DataSyncMsg.MsgData taskTemplateParam) { 1041 private TaskTemplate findByTypeAndParam(Integer event, DataSyncMsg.MsgData taskTemplateParam) {
996 String param = taskTemplateParam.getParam(); 1042 String param = taskTemplateParam.getParam();
997 if (StringUtils.hasText(param)) { 1043 if (StringUtils.isNotBlank(param)) {
998 1044
999 Map<String,String> jsonObject = JSONObject.parseObject(param,Map.class); 1045 Map<String,String> jsonObject = JSONObject.parseObject(param,Map.class);
1000 1046
1001 List<TaskTemplate> taskTemplateList = this.taskTemplateService.findByType(event); 1047 TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findByType(event);
1002 if (!CollectionUtils.isEmpty(taskTemplateList)) { 1048 if (Objects.nonNull(taskTemplateDTO)) {
1003 1049
1004 for (TaskTemplate taskTemplate : taskTemplateList) { 1050 String templateParams = taskTemplateDTO.getParams();
1005 1051 if(StringUtils.isNotBlank(templateParams)) {
1006 String templateParams = taskTemplate.getParams(); 1052 String templateParamsUpperCase = templateParams.toUpperCase();
1007 if(StringUtils.hasText(templateParams)) { 1053 Set<String> keySet = jsonObject.keySet();
1008 String templateParamsUpperCase = templateParams.toUpperCase(); 1054 for (String key : keySet) {
1009 Set<String> keySet = jsonObject.keySet(); 1055 String s = key.toUpperCase();
1010 for (String key : keySet) { 1056 if (s.equals(templateParamsUpperCase)) {
1011 String s = key.toUpperCase(); 1057 TaskTemplate taskTemplate = new TaskTemplate();
1012 if (s.equals(templateParamsUpperCase)) { 1058 BeanUtils.copyProperties(taskTemplateDTO, taskTemplate);
1013 return taskTemplate; 1059 return taskTemplate;
1014 }
1015 continue;
1016 } 1060 }
1061 continue;
1017 } 1062 }
1018
1019 } 1063 }
1020 1064
1021 } 1065 }
...@@ -1075,7 +1119,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -1075,7 +1119,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
1075 tempPoints.setDeviceType(1); 1119 tempPoints.setDeviceType(1);
1076 tempPoints.setEvtType(3); 1120 tempPoints.setEvtType(3);
1077 tempPoints.setPointsType(0); 1121 tempPoints.setPointsType(0);
1078 tempPoints.setExpireTime(LocalDateTime.of(2022,12,31,23,59,59)); 1122 tempPoints.setExpireTime(TimestampUtil.localDateTime2Timestamp(LocalDateTime.of(2022,12,31,23,59,59)));
1079 this.pointsOperationService.grantPointsByManualByTempPoints(tempPoints); 1123 this.pointsOperationService.grantPointsByManualByTempPoints(tempPoints);
1080 } 1124 }
1081 1125
......
...@@ -6,6 +6,7 @@ import com.topdraw.business.module.task.template.domain.TaskTemplateBuilder; ...@@ -6,6 +6,7 @@ import com.topdraw.business.module.task.template.domain.TaskTemplateBuilder;
6 import com.topdraw.business.module.task.template.service.TaskTemplateService; 6 import com.topdraw.business.module.task.template.service.TaskTemplateService;
7 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO; 7 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
8 import com.topdraw.business.process.service.TaskTemplateOperationService; 8 import com.topdraw.business.process.service.TaskTemplateOperationService;
9 import com.topdraw.utils.StringUtils;
9 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
10 import org.springframework.aop.framework.AopContext; 11 import org.springframework.aop.framework.AopContext;
11 import org.springframework.beans.BeanUtils; 12 import org.springframework.beans.BeanUtils;
...@@ -32,50 +33,67 @@ public class TaskTemplateOperationServiceImpl implements TaskTemplateOperationSe ...@@ -32,50 +33,67 @@ public class TaskTemplateOperationServiceImpl implements TaskTemplateOperationSe
32 private TaskTemplateService taskTemplateService; 33 private TaskTemplateService taskTemplateService;
33 34
34 @AsyncMqSend 35 @AsyncMqSend
35 public void asyncTaskTemplate(TaskTemplate resources) {} 36 public void asyncCreate(TaskTemplate resources) {}
37 @AsyncMqSend
38 public void asyncUpdate(TaskTemplate resources) {}
39 @AsyncMqSend
40 public void asyncDelete(TaskTemplate resources) {}
36 41
37 @Override 42 @Override
38 public void create(TaskTemplate resources) { 43 public void create(TaskTemplate resources) {
44
39 TaskTemplate taskTemplate = TaskTemplateBuilder.build(resources); 45 TaskTemplate taskTemplate = TaskTemplateBuilder.build(resources);
40 //TaskTemplateDTO taskTemplate_ = this.taskTemplateService.create(taskTemplate); 46 TaskTemplateDTO taskTemplate_ = this.taskTemplateService.create(taskTemplate);
41 47
42 TaskTemplate taskTemplate1 = new TaskTemplate(); 48 TaskTemplate taskTemplate1 = new TaskTemplate();
43 //BeanUtils.copyProperties(taskTemplate_, taskTemplate1); 49 BeanUtils.copyProperties(taskTemplate_, taskTemplate1);
44 //((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncTaskTemplate(taskTemplate1); 50 ((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncCreate(taskTemplate1);
45 } 51 }
46 52
47 @Override 53 @Override
48 public void update(TaskTemplate resources) { 54 public void update(TaskTemplate resources) {
49 //TaskTemplateDTO taskTemplate_ = this.taskTemplateService.update(resources); 55 TaskTemplateDTO taskTemplate_ = this.taskTemplateService.update(resources);
50 56
51 TaskTemplate taskTemplate1 = new TaskTemplate(); 57 TaskTemplate taskTemplate1 = new TaskTemplate();
52 //BeanUtils.copyProperties(taskTemplate_, taskTemplate1); 58 BeanUtils.copyProperties(taskTemplate_, taskTemplate1);
53 ((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncTaskTemplate(taskTemplate1); 59 ((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncUpdate(taskTemplate1);
54 } 60 }
55 61
56 @Override 62 @Override
57 public void delete(TaskTemplate resources) { 63 public void delete(TaskTemplate resources) {
58 //this.taskTemplateService.delete(resources); 64 this.taskTemplateService.delete(resources);
59 //((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncTaskTemplate(resources); 65 ((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncDelete(resources);
60 } 66 }
61 67
62 @Override 68 @Override
63 public void delete(Long id) { 69 public void delete(Long id) {
64 TaskTemplateDTO taskTemplateDTO = this.findById(id); 70 TaskTemplateDTO taskTemplateDTO = this.findById(id);
65 //this.taskTemplateService.delete(id); 71 if (Objects.nonNull(taskTemplateDTO.getId())) {
66 72 TaskTemplate taskTemplate = new TaskTemplate();
67 TaskTemplate taskTemplate = new TaskTemplate(); 73 taskTemplate.setId(id);
68 BeanUtils.copyProperties(taskTemplateDTO, taskTemplate); 74 taskTemplate.setCode(taskTemplateDTO.getCode());
69 //taskTemplate.setDeleteMark(1); 75 this.delete(taskTemplate);
70 //((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncTaskTemplate(taskTemplate); 76 }
71 } 77 }
72 78
79 @Override
73 public TaskTemplateDTO findByCode(String code) { 80 public TaskTemplateDTO findByCode(String code) {
74 return null;//this.taskTemplateService.findByCode(code); 81 return this.taskTemplateService.findByCode(code);
75 } 82 }
76 83
84 @Override
77 public TaskTemplateDTO findById(Long id) { 85 public TaskTemplateDTO findById(Long id) {
78 return this.taskTemplateService.findById(id); 86 return this.taskTemplateService.findById(id);
79 } 87 }
80 88
89 @Override
90 public TaskTemplateDTO findByEvent(String event) {
91 return this.taskTemplateService.findByEvent(event);
92 }
93
94 @Override
95 public TaskTemplateDTO findByType(Integer type) {
96 return this.taskTemplateService.findByType(type);
97 }
98
81 } 99 }
......
...@@ -36,7 +36,6 @@ import com.topdraw.config.RedisKeyUtil; ...@@ -36,7 +36,6 @@ import com.topdraw.config.RedisKeyUtil;
36 import com.topdraw.exception.BadRequestException; 36 import com.topdraw.exception.BadRequestException;
37 import com.topdraw.exception.EntityNotFoundException; 37 import com.topdraw.exception.EntityNotFoundException;
38 import com.topdraw.exception.GlobeExceptionMsg; 38 import com.topdraw.exception.GlobeExceptionMsg;
39 import com.topdraw.mq.producer.MessageProducer;
40 import com.topdraw.util.TimestampUtil; 39 import com.topdraw.util.TimestampUtil;
41 import com.topdraw.utils.QueryHelp; 40 import com.topdraw.utils.QueryHelp;
42 import com.topdraw.utils.RedisUtils; 41 import com.topdraw.utils.RedisUtils;
...@@ -689,7 +688,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -689,7 +688,7 @@ public class UserOperationServiceImpl implements UserOperationService {
689 bindIptvPlatformType = PLATFORM_LIST[1]; 688 bindIptvPlatformType = PLATFORM_LIST[1];
690 } 689 }
691 memberDTO.setUserIptvId(userTvDTO.getId()); 690 memberDTO.setUserIptvId(userTvDTO.getId());
692 memberDTO.setBindIptvTime(LocalDateTime.now()); 691 memberDTO.setBindIptvTime(TimestampUtil.now());
693 memberDTO.setBindIptvPlatformType(bindIptvPlatformType); 692 memberDTO.setBindIptvPlatformType(bindIptvPlatformType);
694 memberDTO.setPlatformAccount(platformAccount); 693 memberDTO.setPlatformAccount(platformAccount);
695 694
...@@ -771,7 +770,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -771,7 +770,7 @@ public class UserOperationServiceImpl implements UserOperationService {
771 bindIptvPlatformType = PLATFORM_LIST[1]; 770 bindIptvPlatformType = PLATFORM_LIST[1];
772 } 771 }
773 memberDTO.setUserIptvId(userTvDTO.getId()); 772 memberDTO.setUserIptvId(userTvDTO.getId());
774 memberDTO.setBindIptvTime(LocalDateTime.now()); 773 memberDTO.setBindIptvTime(TimestampUtil.now());
775 memberDTO.setBindIptvPlatformType(bindIptvPlatformType); 774 memberDTO.setBindIptvPlatformType(bindIptvPlatformType);
776 memberDTO.setPlatformAccount(platformAccount); 775 memberDTO.setPlatformAccount(platformAccount);
777 776
......
...@@ -17,6 +17,7 @@ import com.topdraw.business.process.domian.weixin.BuyVipBean; ...@@ -17,6 +17,7 @@ import com.topdraw.business.process.domian.weixin.BuyVipBean;
17 import com.topdraw.business.process.service.member.MemberOperationService; 17 import com.topdraw.business.process.service.member.MemberOperationService;
18 import com.topdraw.business.process.service.member.MemberProfileOperationService; 18 import com.topdraw.business.process.service.member.MemberProfileOperationService;
19 import com.topdraw.exception.EntityNotFoundException; 19 import com.topdraw.exception.EntityNotFoundException;
20 import com.topdraw.util.TimestampUtil;
20 import org.springframework.beans.BeanUtils; 21 import org.springframework.beans.BeanUtils;
21 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.cache.annotation.CacheConfig; 23 import org.springframework.cache.annotation.CacheConfig;
...@@ -26,6 +27,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; ...@@ -26,6 +27,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
26 import org.springframework.stereotype.Service; 27 import org.springframework.stereotype.Service;
27 import org.springframework.util.Assert; 28 import org.springframework.util.Assert;
28 29
30 import java.sql.Timestamp;
29 import java.time.LocalDateTime; 31 import java.time.LocalDateTime;
30 import java.time.ZoneOffset; 32 import java.time.ZoneOffset;
31 import java.util.Objects; 33 import java.util.Objects;
...@@ -52,7 +54,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -52,7 +54,7 @@ public class MemberOperationServiceImpl implements MemberOperationService {
52 Long id = resources.getId(); 54 Long id = resources.getId();
53 55
54 // 过期时间 56 // 过期时间
55 LocalDateTime vipExpireTime1 = resources.getVipExpireTime(); 57 Timestamp vipExpireTime1 = resources.getVipExpireTime();
56 Integer vip1 = resources.getVip(); 58 Integer vip1 = resources.getVip();
57 59
58 // 查询微信账户 60 // 查询微信账户
...@@ -65,7 +67,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -65,7 +67,7 @@ public class MemberOperationServiceImpl implements MemberOperationService {
65 Integer vip = memberDTO.getVip(); 67 Integer vip = memberDTO.getVip();
66 68
67 // 69 //
68 LocalDateTime vipExpireTime = memberDTO.getVipExpireTime(); 70 Timestamp vipExpireTime = memberDTO.getVipExpireTime();
69 if (Objects.nonNull(vipExpireTime1)) { 71 if (Objects.nonNull(vipExpireTime1)) {
70 vipExpireTime = vipExpireTime1; 72 vipExpireTime = vipExpireTime1;
71 } 73 }
...@@ -74,9 +76,10 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -74,9 +76,10 @@ public class MemberOperationServiceImpl implements MemberOperationService {
74 if (Objects.isNull(vipExpireTime1)) { 76 if (Objects.isNull(vipExpireTime1)) {
75 if (ObjectUtil.isNull(vipExpireTime)) { 77 if (ObjectUtil.isNull(vipExpireTime)) {
76 LocalDateTime now = LocalDateTime.now(); 78 LocalDateTime now = LocalDateTime.now();
77 vipExpireTime = now.plusYears(1L); 79 vipExpireTime = TimestampUtil.localDateTime2Timestamp(now.plusYears(1L));
78 } else { 80 } else {
79 vipExpireTime = vipExpireTime.plusYears(1L); 81 LocalDateTime localDateTime = TimestampUtil.timestamp2LocalDateTime(vipExpireTime).plusYears(1L);
82 vipExpireTime = TimestampUtil.localDateTime2Timestamp(localDateTime);
80 } 83 }
81 84
82 } 85 }
...@@ -190,7 +193,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -190,7 +193,7 @@ public class MemberOperationServiceImpl implements MemberOperationService {
190 // vip 193 // vip
191 Integer vip = memberDTO.getVip(); 194 Integer vip = memberDTO.getVip();
192 // 过期时间 195 // 过期时间
193 LocalDateTime vipExpireTime = memberDTO.getVipExpireTime(); 196 Timestamp vipExpireTime = memberDTO.getVipExpireTime();
194 197
195 Long timeLong = 0L; 198 Long timeLong = 0L;
196 if (ObjectUtil.isNotNull(vipExpireTime)) { 199 if (ObjectUtil.isNotNull(vipExpireTime)) {
...@@ -206,9 +209,9 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -206,9 +209,9 @@ public class MemberOperationServiceImpl implements MemberOperationService {
206 }); 209 });
207 210
208 vip = memberDTO1.getVip(); 211 vip = memberDTO1.getVip();
209 LocalDateTime vipExpireTime1 = memberDTO1.getVipExpireTime(); 212 Timestamp vipExpireTime1 = memberDTO1.getVipExpireTime();
210 if (Objects.nonNull(vipExpireTime1)) { 213 if (Objects.nonNull(vipExpireTime1)) {
211 timeLong = vipExpireTime1.toInstant(ZoneOffset.of("+8")).toEpochMilli(); 214 timeLong = TimestampUtil.timestamp2long(vipExpireTime1);//vipExpireTime1.toInstant(ZoneOffset.of("+8")).toEpochMilli();
212 } 215 }
213 } 216 }
214 217
...@@ -236,16 +239,16 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -236,16 +239,16 @@ public class MemberOperationServiceImpl implements MemberOperationService {
236 * @param vipExpireTime 239 * @param vipExpireTime
237 * @return 240 * @return
238 */ 241 */
239 private MemberDTO checkVipStatus(MemberDTO memberDTO,LocalDateTime vipExpireTime, String appid) { 242 private MemberDTO checkVipStatus(MemberDTO memberDTO,Timestamp vipExpireTime, String appid) {
240 243
241 Long memberId = memberDTO.getId(); 244 Long memberId = memberDTO.getId();
242 LocalDateTime nowTime = LocalDateTime.now(); 245 Timestamp nowTime = TimestampUtil.now();
243 246
244 //vip过期,回退上个vip状态 同时修改member表vip 247 //vip过期,回退上个vip状态 同时修改member表vip
245 if (nowTime.compareTo(vipExpireTime) >= 0 ) { 248 if (nowTime.compareTo(vipExpireTime) >= 0 ) {
246 249
247 Integer vip = 0; 250 Integer vip = 0;
248 LocalDateTime vipExpireTime1 = memberDTO.getVipExpireTime(); 251 Timestamp vipExpireTime1 = memberDTO.getVipExpireTime();
249 252
250 //查询小于失效时间的那条记录 查不到 取微信表里 关注状态 253 //查询小于失效时间的那条记录 查不到 取微信表里 关注状态
251 MemberVipHistory memberVipHistory = this.memberVipHistoryService.findByTime(memberId, nowTime); 254 MemberVipHistory memberVipHistory = this.memberVipHistoryService.findByTime(memberId, nowTime);
......
...@@ -32,6 +32,12 @@ public class DateUtil { ...@@ -32,6 +32,12 @@ public class DateUtil {
32 return localDateTime; 32 return localDateTime;
33 } 33 }
34 34
35 public static Long getLastDateTimeSecondYearLong(){
36 LocalDateTime localDateTime = getLastDateTimeSecondYear();
37 long l = TimestampUtil.localDateTime2long(localDateTime);
38 return l;
39 }
40
35 41
36 /** 42 /**
37 * 获取指定某一天的开始时间戳 43 * 获取指定某一天的开始时间戳
......
...@@ -10,10 +10,10 @@ public class RandomUtil { ...@@ -10,10 +10,10 @@ public class RandomUtil {
10 * @param min 10 * @param min
11 * @return 11 * @return
12 */ 12 */
13 public static long getRandomPoints(Integer min,Integer max) { 13 public static Long getRandomPoints(Integer min,Integer max) {
14 Random random = new Random(); 14 Random random = new Random();
15 int s = random.nextInt(max)%(max-min+1) + min; 15 int s = random.nextInt(max)%(max-min+1) + min;
16 return s; 16 return Long.valueOf(s);
17 } 17 }
18 18
19 public static void main(String[] args) { 19 public static void main(String[] args) {
......
...@@ -36,6 +36,12 @@ public class TimestampUtil { ...@@ -36,6 +36,12 @@ public class TimestampUtil {
36 return l; 36 return l;
37 } 37 }
38 38
39 public static LocalDateTime timestamp2LocalDateTime(Timestamp timestamp){
40 long l1 = timestamp2long(timestamp);
41 LocalDateTime localDateTime = long2LocalDateTime(l1);
42 return localDateTime;
43 }
44
39 public static LocalDateTime long2LocalDateTime(Long expireTime) { 45 public static LocalDateTime long2LocalDateTime(Long expireTime) {
40 return LocalDateTime.ofInstant(Instant.ofEpochMilli(expireTime),ZoneOffset.of("+8")); 46 return LocalDateTime.ofInstant(Instant.ofEpochMilli(expireTime),ZoneOffset.of("+8"));
41 } 47 }
......
...@@ -6,6 +6,7 @@ import com.topdraw.business.module.points.available.service.dto.PointsAvailableD ...@@ -6,6 +6,7 @@ import com.topdraw.business.module.points.available.service.dto.PointsAvailableD
6 import com.topdraw.business.process.domian.TempPoints; 6 import com.topdraw.business.process.domian.TempPoints;
7 import com.topdraw.BaseTest; 7 import com.topdraw.BaseTest;
8 import com.topdraw.util.IdWorker; 8 import com.topdraw.util.IdWorker;
9 import com.topdraw.util.TimestampUtil;
9 import org.junit.Test; 10 import org.junit.Test;
10 import org.springframework.beans.BeanUtils; 11 import org.springframework.beans.BeanUtils;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,7 +23,7 @@ public class PointsAvailableServiceTest extends BaseTest { ...@@ -22,7 +23,7 @@ public class PointsAvailableServiceTest extends BaseTest {
22 public void loadListExpirePointsByMemberId() { 23 public void loadListExpirePointsByMemberId() {
23 Long memberId = 2L; 24 Long memberId = 2L;
24 List<PointsAvailableDTO> pointsAvailableDTOS = 25 List<PointsAvailableDTO> pointsAvailableDTOS =
25 this.pointsAvailableService.findByMemberIdAndExpireTimeBefore(memberId, LocalDateTime.now()); 26 this.pointsAvailableService.findByMemberIdAndExpireTimeBefore(memberId,TimestampUtil.now());
26 LOG.info("===>>>"+pointsAvailableDTOS); 27 LOG.info("===>>>"+pointsAvailableDTOS);
27 } 28 }
28 29
...@@ -51,7 +52,7 @@ public class PointsAvailableServiceTest extends BaseTest { ...@@ -51,7 +52,7 @@ public class PointsAvailableServiceTest extends BaseTest {
51 // tempPoints.setDescription("#"); 52 // tempPoints.setDescription("#");
52 tempPoints.setEvtType(1); 53 tempPoints.setEvtType(1);
53 tempPoints.setPoints(10L); 54 tempPoints.setPoints(10L);
54 tempPoints.setExpireTime(LocalDateTime.now()); 55 tempPoints.setExpireTime(TimestampUtil.now());
55 56
56 PointsAvailable pointsAvailable = new PointsAvailable(); 57 PointsAvailable pointsAvailable = new PointsAvailable();
57 BeanUtils.copyProperties(tempPoints,pointsAvailable); 58 BeanUtils.copyProperties(tempPoints,pointsAvailable);
......
...@@ -7,6 +7,7 @@ import com.topdraw.business.process.service.member.MemberOperationService; ...@@ -7,6 +7,7 @@ import com.topdraw.business.process.service.member.MemberOperationService;
7 import com.topdraw.business.process.domian.TempPoints; 7 import com.topdraw.business.process.domian.TempPoints;
8 import com.topdraw.BaseTest; 8 import com.topdraw.BaseTest;
9 import com.topdraw.util.IdWorker; 9 import com.topdraw.util.IdWorker;
10 import com.topdraw.util.TimestampUtil;
10 import org.junit.Test; 11 import org.junit.Test;
11 import org.springframework.beans.BeanUtils; 12 import org.springframework.beans.BeanUtils;
12 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
...@@ -37,7 +38,7 @@ public class PointsDetailServiceTest extends BaseTest { ...@@ -37,7 +38,7 @@ public class PointsDetailServiceTest extends BaseTest {
37 tempPoints.setDescription(""); 38 tempPoints.setDescription("");
38 tempPoints.setEvtType(1); 39 tempPoints.setEvtType(1);
39 tempPoints.setPoints(10L); 40 tempPoints.setPoints(10L);
40 tempPoints.setExpireTime(LocalDateTime.now()); 41 tempPoints.setExpireTime(TimestampUtil.now());
41 42
42 MemberDTO memberDTO = this.memberOperationService.findById(memberId); 43 MemberDTO memberDTO = this.memberOperationService.findById(memberId);
43 44
......
...@@ -7,6 +7,7 @@ import com.topdraw.business.module.points.detail.service.PointsDetailService; ...@@ -7,6 +7,7 @@ import com.topdraw.business.module.points.detail.service.PointsDetailService;
7 import com.topdraw.business.process.domian.TempPoints; 7 import com.topdraw.business.process.domian.TempPoints;
8 import com.topdraw.business.process.service.member.MemberOperationService; 8 import com.topdraw.business.process.service.member.MemberOperationService;
9 import com.topdraw.util.IdWorker; 9 import com.topdraw.util.IdWorker;
10 import com.topdraw.util.TimestampUtil;
10 import org.junit.Test; 11 import org.junit.Test;
11 import org.springframework.beans.BeanUtils; 12 import org.springframework.beans.BeanUtils;
12 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
...@@ -37,7 +38,7 @@ public class RightsServiceTest extends BaseTest { ...@@ -37,7 +38,7 @@ public class RightsServiceTest extends BaseTest {
37 tempPoints.setDescription(""); 38 tempPoints.setDescription("");
38 tempPoints.setEvtType(1); 39 tempPoints.setEvtType(1);
39 tempPoints.setPoints(10L); 40 tempPoints.setPoints(10L);
40 tempPoints.setExpireTime(LocalDateTime.now()); 41 tempPoints.setExpireTime(TimestampUtil.now());
41 42
42 MemberDTO memberDTO = this.memberOperationService.findById(memberId); 43 MemberDTO memberDTO = this.memberOperationService.findById(memberId);
43 44
......
...@@ -3,6 +3,7 @@ package com.topdraw.test.business.basicdata.task; ...@@ -3,6 +3,7 @@ package com.topdraw.test.business.basicdata.task;
3 import com.topdraw.business.module.task.template.domain.TaskTemplate; 3 import com.topdraw.business.module.task.template.domain.TaskTemplate;
4 import com.topdraw.business.module.task.template.service.TaskTemplateService; 4 import com.topdraw.business.module.task.template.service.TaskTemplateService;
5 import com.topdraw.BaseTest; 5 import com.topdraw.BaseTest;
6 import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
6 import org.junit.Test; 7 import org.junit.Test;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 9
...@@ -14,7 +15,7 @@ public class TaskTemplateServiceTest extends BaseTest { ...@@ -14,7 +15,7 @@ public class TaskTemplateServiceTest extends BaseTest {
14 @Test 15 @Test
15 public void dealTaskTest(){ 16 public void dealTaskTest(){
16 String eventCode = "tv"; 17 String eventCode = "tv";
17 TaskTemplate taskTemplate = this.taskTemplateService.findByEvent(eventCode); 18 TaskTemplateDTO taskTemplate = this.taskTemplateService.findByEvent(eventCode);
18 LOG.info("=====>>>" + taskTemplate); 19 LOG.info("=====>>>" + taskTemplate);
19 20
20 } 21 }
......
...@@ -7,6 +7,7 @@ import com.topdraw.business.process.domian.TempExp; ...@@ -7,6 +7,7 @@ import com.topdraw.business.process.domian.TempExp;
7 import com.topdraw.business.process.rest.CouponOperationController; 7 import com.topdraw.business.process.rest.CouponOperationController;
8 import com.topdraw.business.process.rest.ExpOperationController; 8 import com.topdraw.business.process.rest.ExpOperationController;
9 import com.topdraw.common.ResultInfo; 9 import com.topdraw.common.ResultInfo;
10 import com.topdraw.util.TimestampUtil;
10 import org.junit.Test; 11 import org.junit.Test;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
12 13
...@@ -29,7 +30,7 @@ public class ExpOperationControllerTest extends BaseTest { ...@@ -29,7 +30,7 @@ public class ExpOperationControllerTest extends BaseTest {
29 tempExp.setRewardExp(10L); 30 tempExp.setRewardExp(10L);
30 tempExp.setRightsSendStrategy(0); 31 tempExp.setRightsSendStrategy(0);
31 tempExp.setAccountId(userId); 32 tempExp.setAccountId(userId);
32 tempExp.setExpireTime(LocalDateTime.now()); 33 tempExp.setExpireTime(TimestampUtil.now());
33 tempExp.setDeviceType(2); 34 tempExp.setDeviceType(2);
34 tempExp.setAppCode("WEI_XIN_GOLD_PANDA"); 35 tempExp.setAppCode("WEI_XIN_GOLD_PANDA");
35 tempExp.setOrderId(null); 36 tempExp.setOrderId(null);
......
...@@ -5,6 +5,7 @@ import com.topdraw.BaseTest; ...@@ -5,6 +5,7 @@ import com.topdraw.BaseTest;
5 import com.topdraw.business.process.domian.TempPoints; 5 import com.topdraw.business.process.domian.TempPoints;
6 import com.topdraw.business.process.rest.PointsOperationController; 6 import com.topdraw.business.process.rest.PointsOperationController;
7 import com.topdraw.common.ResultInfo; 7 import com.topdraw.common.ResultInfo;
8 import com.topdraw.util.TimestampUtil;
8 import org.junit.Test; 9 import org.junit.Test;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 11
...@@ -39,7 +40,7 @@ public class PointsOperationControllerTest extends BaseTest { ...@@ -39,7 +40,7 @@ public class PointsOperationControllerTest extends BaseTest {
39 tempPoints.setPointsType(0); 40 tempPoints.setPointsType(0);
40 tempPoints.setRightsSendStrategy(0); 41 tempPoints.setRightsSendStrategy(0);
41 tempPoints.setAccountId(2L); 42 tempPoints.setAccountId(2L);
42 tempPoints.setExpireTime(LocalDateTime.now()); 43 tempPoints.setExpireTime(TimestampUtil.now());
43 tempPoints.setDeviceType(2); 44 tempPoints.setDeviceType(2);
44 tempPoints.setAppCode("WEI_XIN_GOLD_PANDA"); 45 tempPoints.setAppCode("WEI_XIN_GOLD_PANDA");
45 tempPoints.setOrderId(null); 46 tempPoints.setOrderId(null);
...@@ -72,7 +73,7 @@ public class PointsOperationControllerTest extends BaseTest { ...@@ -72,7 +73,7 @@ public class PointsOperationControllerTest extends BaseTest {
72 tempPoints.setDescription("系统发放"); 73 tempPoints.setDescription("系统发放");
73 tempPoints.setEvtType(1); 74 tempPoints.setEvtType(1);
74 String s = JSON.toJSONString(tempPoints);*/ 75 String s = JSON.toJSONString(tempPoints);*/
75 ResultInfo byId = this.pointsOperationController.cleanInvalidPointsAndCalculateCurrentPoints(5L); 76 ResultInfo byId = this.pointsOperationController.cleanInvalidPointsAndCalculateCurrentPoints(22L);
76 LOG.info("===>>>"+byId); 77 LOG.info("===>>>"+byId);
77 } 78 }
78 79
......
...@@ -5,6 +5,7 @@ import com.topdraw.BaseTest; ...@@ -5,6 +5,7 @@ import com.topdraw.BaseTest;
5 import com.topdraw.business.module.rights.history.domain.RightsHistory; 5 import com.topdraw.business.module.rights.history.domain.RightsHistory;
6 import com.topdraw.business.process.rest.RightsOperationController; 6 import com.topdraw.business.process.rest.RightsOperationController;
7 import com.topdraw.common.ResultInfo; 7 import com.topdraw.common.ResultInfo;
8 import com.topdraw.util.TimestampUtil;
8 import org.junit.Test; 9 import org.junit.Test;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 11
...@@ -22,7 +23,7 @@ public class RightOperationControllerTest extends BaseTest { ...@@ -22,7 +23,7 @@ public class RightOperationControllerTest extends BaseTest {
22 rightsHistory.setMemberId(3L); 23 rightsHistory.setMemberId(3L);
23 rightsHistory.setOperatorId(3L); 24 rightsHistory.setOperatorId(3L);
24 rightsHistory.setOperatorName("鲁二龙"); 25 rightsHistory.setOperatorName("鲁二龙");
25 rightsHistory.setExpireTime(LocalDateTime.now()); 26 rightsHistory.setExpireTime(TimestampUtil.now());
26 rightsHistory.setUserId(2L); 27 rightsHistory.setUserId(2L);
27 ResultInfo byId = this.rightsOperationController.grantRightsByManual(rightsHistory); 28 ResultInfo byId = this.rightsOperationController.grantRightsByManual(rightsHistory);
28 LOG.info("===>>>"+byId); 29 LOG.info("===>>>"+byId);
......
1 package com.topdraw.test.business.process.rest; 1 package com.topdraw.test.business.process.rest;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.topdraw.business.module.task.domain.Task;
5 import com.topdraw.business.module.task.service.dto.TaskDTO;
4 import com.topdraw.business.process.rest.TaskOperationController; 6 import com.topdraw.business.process.rest.TaskOperationController;
7 import com.topdraw.business.process.service.TaskOperationService;
5 import com.topdraw.business.process.service.dto.TaskOperationQueryCriteria; 8 import com.topdraw.business.process.service.dto.TaskOperationQueryCriteria;
6 import com.topdraw.module.mq.DataSyncMsg; 9 import com.topdraw.module.mq.DataSyncMsg;
7 import com.topdraw.module.mq.EventType; 10 import com.topdraw.module.mq.EventType;
8 import com.topdraw.BaseTest; 11 import com.topdraw.BaseTest;
12 import com.topdraw.util.TimestampUtil;
9 import org.junit.Test; 13 import org.junit.Test;
14 import org.springframework.beans.BeanUtils;
10 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 16 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
12 17
18 import java.time.LocalDateTime;
13 import java.util.concurrent.FutureTask; 19 import java.util.concurrent.FutureTask;
14 20
15 public class TaskOperationControllerTest extends BaseTest { 21 public class TaskOperationControllerTest extends BaseTest {
16 22
17 @Autowired 23 @Autowired
18 TaskOperationController taskOperationController; 24 TaskOperationController taskOperationController;
25 @Autowired
26 TaskOperationService taskOperationService;
27
28 @Test
29 public void createTask() {
30 Task task = new Task();
31 task.setName("testTask");
32 task.setCode("testTaskCode1122");
33 task.setRightsSendStrategy(0);
34 task.setMemberLevel(null);
35 task.setMemberVip(null);
36 task.setActionAmount(1);
37 task.setGroups(null);
38 task.setRewardExp(0L);
39 task.setStatus(1);
40 task.setTaskDailyReset(1);
41 task.setTaskRepeatType(1);
42 task.setTaskTemplateId(13L);
43 task.setExpireTime(TimestampUtil.now());
44 task.setValidTime(TimestampUtil.now());
45 task.setPointsType(0);
46
47 task.setAttr("{\"value\":\"[1,2]\"}");
48
49 task.setTaskTemplateId(13L);
50
51 this.taskOperationController.createTask(task);
52 }
53
54 @Test
55 public void updateTask() {
56
57 TaskDTO taskDTO = this.taskOperationService.findById(15L);
58 Task task = new Task();
59 BeanUtils.copyProperties(taskDTO, task);
60 task.setName("testTask4455");
61 task.setAttr("{\"value\":\"[4,10]\"}");
62 this.taskOperationController.updateTask(task);
63 }
64
65 @Test
66 public void deleteTask() {
67 Task task = new Task();
68 task.setId(15L);
69 this.taskOperationController.deleteTask(task);
70 }
71
19 72
20 @Test 73 @Test
21 public void activity() { 74 public void activity() {
......
...@@ -73,7 +73,7 @@ public class MemberOperationServiceTest extends BaseTest { ...@@ -73,7 +73,7 @@ public class MemberOperationServiceTest extends BaseTest {
73 member.setDueCouponAmount(0L); 73 member.setDueCouponAmount(0L);
74 member.setUserIptvId(1L); 74 member.setUserIptvId(1L);
75 member.setBindIptvPlatformType(0); 75 member.setBindIptvPlatformType(0);
76 member.setBindIptvTime(LocalDateTime.now()); 76 member.setBindIptvTime(TimestampUtil.now());
77 // member.setUpdateTime(Timestamp.valueOf(LocalDateTime.now())); 77 // member.setUpdateTime(Timestamp.valueOf(LocalDateTime.now()));
78 this.memberOperationService.doInsertMember(member); 78 this.memberOperationService.doInsertMember(member);
79 } 79 }
......