Commit 3c564750 3c564750736caf05cef92d844340463f0c8a097c by xianghan@topdraw.cn

1.接口优化,删除不必要的接口

1 parent 7c7d4f22
Showing 100 changed files with 1087 additions and 1530 deletions
...@@ -25,94 +25,94 @@ import java.time.LocalDateTime; ...@@ -25,94 +25,94 @@ import java.time.LocalDateTime;
25 @Table(name="m_coupon") 25 @Table(name="m_coupon")
26 public class Coupon implements Serializable { 26 public class Coupon implements Serializable {
27 27
28 // id 28 /** id */
29 @Id 29 @Id
30 @GeneratedValue(strategy = GenerationType.IDENTITY) 30 @GeneratedValue(strategy = GenerationType.IDENTITY)
31 @Column(name = "id") 31 @Column(name = "id")
32 private Long id; 32 private Long id;
33 33
34 // 标识 34 /** 标识 */
35 @Column(name = "code", nullable = false) 35 @Column(name = "code", nullable = false)
36 private String code; 36 private String code;
37 37
38 // 名称 38 /** 名称 */
39 @Column(name = "title", nullable = false) 39 @Column(name = "title", nullable = false)
40 private String title; 40 private String title;
41 41
42 // 图片 42 /** 图片 */
43 @Column(name = "images") 43 @Column(name = "images")
44 private String images; 44 private String images;
45 45
46 // 发行量,-1代表不限量 46 /** 发行量,-1代表不限量 */
47 @Column(name = "stock") 47 @Column(name = "stock")
48 private Integer stock; 48 private Integer stock;
49 49
50 // 剩余量,-1代表不限量 50 /** 剩余量,-1代表不限量 */
51 @Column(name = "remain_stock") 51 @Column(name = "remain_stock")
52 private Integer remainStock; 52 private Integer remainStock;
53 53
54 // 优惠形式:1:现金;2:折扣 54 /** 优惠形式:1:现金;2:折扣 */
55 @Column(name = "use_type") 55 @Column(name = "use_type")
56 private Integer useType; 56 private Integer useType;
57 57
58 // 面额 58 /** 面额 */
59 @Column(name = "denomination") 59 @Column(name = "denomination")
60 private BigDecimal denomination; 60 private BigDecimal denomination;
61 61
62 // 折扣 62 /** 折扣 */
63 @Column(name = "discount") 63 @Column(name = "discount")
64 private BigDecimal discount; 64 private BigDecimal discount;
65 65
66 // 适用用户范围:1:新用户;2:全体用户 66 /** 适用用户范围:1:新用户;2:全体用户 */
67 @Column(name = "user_range") 67 @Column(name = "user_range")
68 private Integer userRange; 68 private Integer userRange;
69 69
70 // 限领次数 -1:无限次; >0:具体次数 70 /** 限领次数 -1:无限次; >0:具体次数 */
71 @Column(name = "collect_limit") 71 @Column(name = "collect_limit")
72 private Integer collectLimit; 72 private Integer collectLimit;
73 73
74 // 适用门槛:1:无门槛;2:满减形式 74 /** 适用门槛:1:无门槛;2:满减形式 */
75 @Column(name = "threshold_type") 75 @Column(name = "threshold_type")
76 private Integer thresholdType; 76 private Integer thresholdType;
77 77
78 // 满减门槛 78 /** 满减门槛 */
79 @Column(name = "amount_threshold") 79 @Column(name = "amount_threshold")
80 private BigDecimal amountThreshold; 80 private BigDecimal amountThreshold;
81 81
82 // 产品范围:1:全部商品;2:指定商品 82 /** 产品范围:1:全部商品;2:指定商品 */
83 @Column(name = "item_range") 83 @Column(name = "item_range")
84 private Integer itemRange; 84 private Integer itemRange;
85 85
86 // 生效形式:1:固定日期;2:相对日期 86 /** 生效形式:1:固定日期;2:相对日期 */
87 @Column(name = "effect_type") 87 @Column(name = "effect_type")
88 private Integer effectType; 88 private Integer effectType;
89 89
90 // 生效时间 90 /** 生效时间 */
91 @Column(name = "start_time") 91 @Column(name = "start_time")
92 private Timestamp startTime; 92 private Timestamp startTime;
93 93
94 // 过期时间 94 /** 过期时间 */
95 @Column(name = "expire_time") 95 @Column(name = "expire_time")
96 private LocalDateTime expireTime; 96 private LocalDateTime expireTime;
97 97
98 // 自领取当日,几天内有效 98 /** 自领取当日,几天内有效 */
99 @Column(name = "valid_days") 99 @Column(name = "valid_days")
100 private Integer validDays; 100 private Integer validDays;
101 101
102 // 使用说明 102 /** 使用说明 */
103 @Column(name = "description") 103 @Column(name = "description")
104 private String description; 104 private String description;
105 105
106 // 状态0:未开始,1:启用;2:停用 106 /** 状态0:未开始,1:启用;2:停用 */
107 @Column(name = "status") 107 @Column(name = "status")
108 private Integer status; 108 private Integer status;
109 109
110 // 创建时间 110 /** 创建时间 */
111 @CreatedDate 111 @CreatedDate
112 @Column(name = "create_time") 112 @Column(name = "create_time")
113 private Timestamp createTime; 113 private Timestamp createTime;
114 114
115 // 更新时间 115 /** 更新时间 */
116 @LastModifiedDate 116 @LastModifiedDate
117 @Column(name = "update_time") 117 @Column(name = "update_time")
118 private Timestamp updateTime; 118 private Timestamp updateTime;
......
1 package com.topdraw.business.module.coupon.domain;
2
3 import com.topdraw.business.module.coupon.service.dto.CouponDTO;
4 import com.topdraw.util.IdWorker;
5 import org.apache.commons.lang3.StringUtils;
6 import org.springframework.beans.BeanUtils;
7
8 import java.math.BigDecimal;
9 import java.sql.Timestamp;
10 import java.time.LocalDateTime;
11 import java.util.Objects;
12
13 /**
14 * 优惠券
15 */
16 public class CouponBuilder {
17
18 public static Coupon build(CouponDTO couponDTO){
19 Coupon coupon = new Coupon();
20 BeanUtils.copyProperties(couponDTO,coupon);
21 return build(coupon.getId(),
22 coupon.getCode(),
23 coupon.getTitle(),coupon.getImages(),coupon.getStock(),coupon.getRemainStock(),coupon.getUseType(),
24 coupon.getDenomination(),coupon.getDiscount(),coupon.getUserRange(),coupon.getCollectLimit(),
25 coupon.getThresholdType(),coupon.getAmountThreshold(),coupon.getItemRange(),coupon.getEffectType(),
26 coupon.getStartTime(),coupon.getExpireTime(),coupon.getValidDays(),coupon.getDescription(),coupon.getStatus());
27 }
28
29 public static Coupon build(Coupon coupon){
30 return build(coupon.getId(),
31 coupon.getCode(),
32 coupon.getTitle(),coupon.getImages(),coupon.getStock(),coupon.getRemainStock(),coupon.getUseType(),
33 coupon.getDenomination(),coupon.getDiscount(),coupon.getUserRange(),coupon.getCollectLimit(),
34 coupon.getThresholdType(),coupon.getAmountThreshold(),coupon.getItemRange(),coupon.getEffectType(),
35 coupon.getStartTime(),coupon.getExpireTime(),coupon.getValidDays(),coupon.getDescription(),coupon.getStatus());
36 }
37
38 public static Coupon build(Long id , String code , String title,
39 String images,
40 Integer stock,
41 Integer remainStock,
42 Integer useType,
43 BigDecimal denomination,
44 BigDecimal discount,
45 Integer userRange,
46 Integer collectLimit,
47 Integer thresholdType,
48 BigDecimal amountThreshold,
49 Integer itemRange,
50 Integer effectType,
51 Timestamp startTime,
52 LocalDateTime expireTime,
53 Integer validDays,String description , Integer status){
54
55 Coupon coupon = new Coupon();
56 coupon.setId(id);
57 coupon.setCode(StringUtils.isBlank(code)? IdWorker.generatorCode("coupon"):code);
58 coupon.setTitle(StringUtils.isBlank(title)?null:title);
59 coupon.setImages(StringUtils.isBlank(images)?null:images);
60 coupon.setStock(Objects.isNull(stock)?null:stock);
61 coupon.setRemainStock(Objects.isNull(remainStock)?null:remainStock);
62 coupon.setUseType(Objects.isNull(useType)?null:useType);
63 coupon.setDenomination(Objects.isNull(denomination)?null:denomination);
64 coupon.setDiscount(Objects.isNull(discount)?null:discount);
65 coupon.setUserRange(Objects.isNull(userRange)?null:userRange);
66 coupon.setCollectLimit(collectLimit);
67 coupon.setThresholdType(Objects.isNull(thresholdType)?null:thresholdType);
68 coupon.setAmountThreshold(Objects.isNull(amountThreshold)?null:amountThreshold);
69 coupon.setItemRange(Objects.isNull(itemRange)?null:itemRange);
70 coupon.setEffectType(Objects.isNull(effectType)?null:effectType);
71 coupon.setStartTime(Objects.isNull(startTime)?null: startTime);
72 coupon.setExpireTime(Objects.isNull(expireTime)?null:expireTime);
73 coupon.setValidDays(validDays);
74 coupon.setDescription(StringUtils.isBlank(description)?"":description);
75 coupon.setStatus(Objects.nonNull(status)?status:0);
76 return coupon;
77 }
78
79 }
...@@ -24,54 +24,54 @@ import java.time.LocalDateTime; ...@@ -24,54 +24,54 @@ import java.time.LocalDateTime;
24 @Table(name="m_coupon_history") 24 @Table(name="m_coupon_history")
25 public class CouponHistory implements Serializable { 25 public class CouponHistory implements Serializable {
26 26
27 // 主键 27 /** 主键 */
28 @Id 28 @Id
29 @GeneratedValue(strategy = GenerationType.IDENTITY) 29 @GeneratedValue(strategy = GenerationType.IDENTITY)
30 @Column(name = "id") 30 @Column(name = "id")
31 private Long id; 31 private Long id;
32 32
33 // 优惠券id 33 /** 优惠券id */
34 @Column(name = "coupon_id") 34 @Column(name = "coupon_id")
35 private Long couponId; 35 private Long couponId;
36 36
37 // 领券用户id(对应账号) 37 /** 领券用户id(对应账号) */
38 @Column(name = "user_id") 38 @Column(name = "user_id")
39 private Long userId; 39 private Long userId;
40 40
41 // 优惠券code 41 /** 优惠券code */
42 @Column(name = "coupon_code") 42 @Column(name = "coupon_code")
43 private String couponCode; 43 private String couponCode;
44 44
45 // 领取人昵称 45 /** 领取人昵称 */
46 @Column(name = "user_nickname") 46 @Column(name = "user_nickname")
47 private String userNickname; 47 private String userNickname;
48 48
49 // 领取时间 49 /** 领取时间 */
50 @Column(name = "receive_time") 50 @Column(name = "receive_time")
51 private LocalDateTime receiveTime; 51 private LocalDateTime receiveTime;
52 52
53 // 失效时间 53 /** 失效时间 */
54 @Column(name = "expire_time") 54 @Column(name = "expire_time")
55 private LocalDateTime expireTime; 55 private LocalDateTime expireTime;
56 56
57 // 使用状态 0:未使用;1:已使用;-1:已过期 57 /** 使用状态 0:未使用;1:已使用;-1:已过期 */
58 @Column(name = "use_status") 58 @Column(name = "use_status")
59 private Integer useStatus; 59 private Integer useStatus;
60 60
61 // 使用时间 61 /** 使用时间 */
62 @Column(name = "use_time") 62 @Column(name = "use_time")
63 private LocalDateTime useTime; 63 private LocalDateTime useTime;
64 64
65 // 订单详情id 65 /** 订单详情id */
66 @Column(name = "order_detail_id") 66 @Column(name = "order_detail_id")
67 private Long orderDetailId; 67 private Long orderDetailId;
68 68
69 // 创建时间 69 /** 创建时间 */
70 @CreatedDate 70 @CreatedDate
71 @Column(name = "create_time") 71 @Column(name = "create_time")
72 private LocalDateTime createTime; 72 private LocalDateTime createTime;
73 73
74 // 更新时间 74 /** 更新时间 */
75 @LastModifiedDate 75 @LastModifiedDate
76 @Column(name = "update_time") 76 @Column(name = "update_time")
77 private LocalDateTime updateTime; 77 private LocalDateTime updateTime;
......
1 package com.topdraw.business.module.coupon.history.domain;
2
3 import com.topdraw.business.module.coupon.domain.Coupon;
4 import org.apache.commons.lang3.StringUtils;
5
6 import java.time.LocalDateTime;
7 import java.util.Objects;
8
9 /**
10 * 优惠券
11 */
12 public class CouponHistoryBuilder {
13
14 public static CouponHistory build(CouponHistory couponHistory){
15 return build(couponHistory.getId(),
16 couponHistory.getCouponId(),
17 couponHistory.getUserId(),
18 couponHistory.getCouponCode(),
19 couponHistory.getUserNickname(),
20 couponHistory.getReceiveTime(),
21 couponHistory.getExpireTime(),
22 couponHistory.getUseStatus(),
23 couponHistory.getUseTime(),
24 couponHistory.getOrderDetailId());
25 }
26
27 public static CouponHistory build(Coupon coupon,Long userId,String userNickname){
28 return build(coupon,userId,userNickname,null);
29 }
30
31 public static CouponHistory build(Coupon coupon,Long userId,String userNickname,Long orderDetailId){
32 return build(null,
33 coupon.getId(),userId,coupon.getCode(),userNickname,LocalDateTime.now(),
34 coupon.getExpireTime(),coupon.getStatus(),null,orderDetailId);
35 }
36
37 public static CouponHistory build(Long id , Long couponId , Long userId,String couponCode,String userNickname,LocalDateTime receiveTime,
38 LocalDateTime expireTime,Integer useStatus,LocalDateTime useTime,
39 Long orderDetailId) {
40 CouponHistory couponHistory = new CouponHistory();
41 couponHistory.setId(id);
42 couponHistory.setCouponId(Objects.isNull(couponId)?null:couponId);
43 couponHistory.setUserId(Objects.isNull(userId)?null:userId);
44 couponHistory.setCouponCode(StringUtils.isBlank(couponCode)?null:couponCode);
45 couponHistory.setUserNickname(StringUtils.isBlank(userNickname)?null:userNickname);
46 couponHistory.setReceiveTime(Objects.isNull(receiveTime)?null:receiveTime);
47 couponHistory.setExpireTime(Objects.isNull(expireTime)?null:expireTime);
48 couponHistory.setUseStatus(Objects.isNull(useStatus)?0:useStatus);
49 couponHistory.setUseTime(Objects.isNull(useTime)?null:useTime);
50 couponHistory.setOrderDetailId(Objects.isNull(orderDetailId)?null:orderDetailId);
51 return couponHistory;
52 }
53
54 }
1 package com.topdraw.business.module.coupon.history.rest;
2
3 import com.topdraw.common.ResultInfo;
4 import com.topdraw.business.module.coupon.history.domain.CouponHistory;
5 import com.topdraw.business.module.coupon.history.service.CouponHistoryService;
6 import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.data.domain.Pageable;
9 import org.springframework.validation.annotation.Validated;
10 import org.springframework.web.bind.annotation.*;
11 import io.swagger.annotations.*;
12
13 /**
14 * @author XiangHan
15 * @date 2021-10-23
16 */
17 @Api(tags = "CouponHistory管理")
18 @RestController
19 @RequestMapping("/api/CouponHistory")
20 public class CouponHistoryController {
21
22 @Autowired
23 private CouponHistoryService CouponHistoryService;
24
25 @GetMapping
26 @ApiOperation("查询CouponHistory")
27 public ResultInfo getCouponHistorys(CouponHistoryQueryCriteria criteria, Pageable pageable) {
28 return ResultInfo.successPage(CouponHistoryService.queryAll(criteria,pageable));
29 }
30
31 @GetMapping(value = "/all")
32 @ApiOperation("查询所有CouponHistory")
33 public ResultInfo getCouponHistorys(CouponHistoryQueryCriteria criteria) {
34 return ResultInfo.success(CouponHistoryService.queryAll(criteria));
35 }
36
37 @PostMapping(value = "/create")
38 @ApiOperation("新增CouponHistory")
39 public ResultInfo create(@Validated @RequestBody CouponHistory resources) {
40 CouponHistoryService.create(resources);
41 return ResultInfo.success();
42 }
43
44 @PutMapping(value = "/update")
45 @ApiOperation("修改CouponHistory")
46 public ResultInfo update(@Validated @RequestBody CouponHistory resources) {
47 CouponHistoryService.update(resources);
48 return ResultInfo.success();
49 }
50
51
52 @DeleteMapping(value = "/delete/{id}")
53 @ApiOperation("删除CouponHistory")
54 public ResultInfo delete(@PathVariable Long id) {
55 CouponHistoryService.delete(id);
56 return ResultInfo.success();
57 }
58
59 }
...@@ -2,12 +2,9 @@ package com.topdraw.business.module.coupon.history.service; ...@@ -2,12 +2,9 @@ package com.topdraw.business.module.coupon.history.service;
2 2
3 import com.topdraw.business.module.coupon.history.domain.CouponHistory; 3 import com.topdraw.business.module.coupon.history.domain.CouponHistory;
4 import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; 4 import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO;
5 import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; 5 import com.topdraw.business.module.coupon.service.dto.CouponDTO;
6 import org.springframework.data.domain.Pageable;
7 6
8 import java.sql.Timestamp;
9 import java.time.LocalDateTime; 7 import java.time.LocalDateTime;
10 import java.util.Map;
11 import java.util.List; 8 import java.util.List;
12 9
13 /** 10 /**
...@@ -16,20 +13,6 @@ import java.util.List; ...@@ -16,20 +13,6 @@ import java.util.List;
16 */ 13 */
17 public interface CouponHistoryService { 14 public interface CouponHistoryService {
18 15
19 /**
20 * 查询数据分页
21 * @param criteria 条件参数
22 * @param pageable 分页参数
23 * @return Map<String,Object>
24 */
25 Map<String,Object> queryAll(CouponHistoryQueryCriteria criteria, Pageable pageable);
26
27 /**
28 * 查询所有数据不分页
29 * @param criteria 条件参数
30 * @return List<CouponHistoryDTO>
31 */
32 List<CouponHistoryDTO> queryAll(CouponHistoryQueryCriteria criteria);
33 16
34 /** 17 /**
35 * 根据ID查询 18 * 根据ID查询
...@@ -38,15 +21,45 @@ public interface CouponHistoryService { ...@@ -38,15 +21,45 @@ public interface CouponHistoryService {
38 */ 21 */
39 CouponHistoryDTO findById(Long id); 22 CouponHistoryDTO findById(Long id);
40 23
24 /**
25 *
26 * @param resources
27 */
41 void create(CouponHistory resources); 28 void create(CouponHistory resources);
42 29
30 /**
31 *
32 * @param resources
33 */
43 void update(CouponHistory resources); 34 void update(CouponHistory resources);
44 35
36 /**
37 *
38 * @param id
39 */
45 void delete(Long id); 40 void delete(Long id);
46 41
42 /**
43 *
44 * @param userId
45 * @return
46 */
47 Long countByUserId(Long userId); 47 Long countByUserId(Long userId);
48 48
49 /**
50 *
51 * @param userId
52 * @param now
53 * @return
54 */
49 Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now); 55 Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now);
50 56
57 /**
58 *
59 * @param userId
60 * @param now
61 * @param expireTime
62 * @return
63 */
51 Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime); 64 Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime);
52 } 65 }
......
...@@ -12,39 +12,39 @@ import java.time.LocalDateTime; ...@@ -12,39 +12,39 @@ import java.time.LocalDateTime;
12 @Data 12 @Data
13 public class CouponHistoryDTO implements Serializable { 13 public class CouponHistoryDTO implements Serializable {
14 14
15 // 主键 15 /** 主键 */
16 private Long id; 16 private Long id;
17 17
18 // 优惠券id 18 /** 优惠券id */
19 private Long couponId; 19 private Long couponId;
20 20
21 // 领券用户id(对应账号) 21 /** 领券用户id(对应账号) */
22 private Long userId; 22 private Long userId;
23 23
24 // 优惠券code 24 /** 优惠券code */
25 private String couponCode; 25 private String couponCode;
26 26
27 // 领取人昵称 27 /** 领取人昵称 */
28 private String userNickname; 28 private String userNickname;
29 29
30 // 领取时间 30 /** 领取时间 */
31 private LocalDateTime receiveTime; 31 private LocalDateTime receiveTime;
32 32
33 // 失效时间 33 /** 失效时间 */
34 private LocalDateTime expireTime; 34 private LocalDateTime 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 LocalDateTime 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 LocalDateTime createTime;
47 47
48 // 更新时间 48 /** 更新时间 */
49 private LocalDateTime updateTime; 49 private LocalDateTime updateTime;
50 } 50 }
......
1 package com.topdraw.business.module.coupon.history.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author XiangHan
7 * @date 2021-10-23
8 */
9 @Data
10 public class CouponHistoryQueryCriteria{
11 }
1 package com.topdraw.business.module.coupon.history.service.impl; 1 package com.topdraw.business.module.coupon.history.service.impl;
2 2
3 import com.topdraw.aspect.AsyncMqSend;
4 import com.topdraw.business.module.coupon.history.domain.CouponHistory; 3 import com.topdraw.business.module.coupon.history.domain.CouponHistory;
4 import com.topdraw.business.module.coupon.history.domain.CouponHistoryBuilder;
5 import com.topdraw.utils.ValidationUtil; 5 import com.topdraw.utils.ValidationUtil;
6 import com.topdraw.business.module.coupon.history.repository.CouponHistoryRepository; 6 import com.topdraw.business.module.coupon.history.repository.CouponHistoryRepository;
7 import com.topdraw.business.module.coupon.history.service.CouponHistoryService; 7 import com.topdraw.business.module.coupon.history.service.CouponHistoryService;
8 import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; 8 import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO;
9 import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria;
10 import com.topdraw.business.module.coupon.history.service.mapper.CouponHistoryMapper; 9 import com.topdraw.business.module.coupon.history.service.mapper.CouponHistoryMapper;
11 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
13 import org.springframework.transaction.annotation.Propagation; 12 import org.springframework.transaction.annotation.Propagation;
14 import org.springframework.transaction.annotation.Transactional; 13 import org.springframework.transaction.annotation.Transactional;
15 import org.springframework.dao.EmptyResultDataAccessException; 14 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; 15 import org.springframework.util.Assert;
19 import com.topdraw.utils.PageUtil;
20 import com.topdraw.utils.QueryHelp;
21 16
22 import java.sql.Timestamp;
23 import java.time.LocalDateTime; 17 import java.time.LocalDateTime;
24 import java.util.List;
25 import java.util.Map;
26 18
27 /** 19 /**
28 * @author XiangHan 20 * @author XiangHan
...@@ -33,67 +25,56 @@ import java.util.Map; ...@@ -33,67 +25,56 @@ import java.util.Map;
33 public class CouponHistoryServiceImpl implements CouponHistoryService { 25 public class CouponHistoryServiceImpl implements CouponHistoryService {
34 26
35 @Autowired 27 @Autowired
36 private CouponHistoryRepository CouponHistoryRepository; 28 private CouponHistoryMapper couponHistoryMapper;
37
38 @Autowired 29 @Autowired
39 private CouponHistoryMapper CouponHistoryMapper; 30 private CouponHistoryRepository couponHistoryRepository;
40 31
41 @Override
42 public Map<String, Object> queryAll(CouponHistoryQueryCriteria criteria, Pageable pageable) {
43 Page<CouponHistory> page = CouponHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
44 return PageUtil.toPage(page.map(CouponHistoryMapper::toDto));
45 }
46
47 @Override
48 public List<CouponHistoryDTO> queryAll(CouponHistoryQueryCriteria criteria) {
49 return CouponHistoryMapper.toDto(CouponHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
50 }
51 32
52 @Override 33 @Override
53 public CouponHistoryDTO findById(Long id) { 34 public CouponHistoryDTO findById(Long id) {
54 CouponHistory CouponHistory = CouponHistoryRepository.findById(id).orElseGet(CouponHistory::new); 35 CouponHistory couponHistory = this.couponHistoryRepository.findById(id).orElseGet(CouponHistory::new);
55 ValidationUtil.isNull(CouponHistory.getId(),"CouponHistory","id",id); 36 ValidationUtil.isNull(couponHistory.getId(),"CouponHistory","id",id);
56 return CouponHistoryMapper.toDto(CouponHistory); 37 return this.couponHistoryMapper.toDto(couponHistory);
57 } 38 }
58 39
59 @Override 40 @Override
60 @Transactional(rollbackFor = Exception.class) 41 @Transactional(rollbackFor = Exception.class)
61 public void create(CouponHistory resources) { 42 public void create(CouponHistory resources) {
62 CouponHistoryRepository.save(resources); 43 CouponHistory couponHistory = CouponHistoryBuilder.build(resources);
44 this.couponHistoryRepository.save(couponHistory);
63 } 45 }
64 46
65 @Override 47 @Override
66 @Transactional(rollbackFor = Exception.class) 48 @Transactional(rollbackFor = Exception.class)
67 public void update(CouponHistory resources) { 49 public void update(CouponHistory resources) {
68 CouponHistory CouponHistory = CouponHistoryRepository.findById(resources.getId()).orElseGet(CouponHistory::new); 50 CouponHistory couponHistory = this.couponHistoryRepository.findById(resources.getId()).orElseGet(CouponHistory::new);
69 ValidationUtil.isNull( CouponHistory.getId(),"CouponHistory","id",resources.getId()); 51 ValidationUtil.isNull(couponHistory.getId(),"CouponHistory","id",resources.getId());
70 CouponHistory.copy(resources); 52 couponHistory.copy(resources);
71 CouponHistoryRepository.save(CouponHistory); 53 this.couponHistoryRepository.save(couponHistory);
72 } 54 }
73 55
74 @Override 56 @Override
75 @Transactional(rollbackFor = Exception.class) 57 @Transactional(rollbackFor = Exception.class)
76 public void delete(Long id) { 58 public void delete(Long id) {
77 Assert.notNull(id, "The given id must not be null!"); 59 Assert.notNull(id, "The given id must not be null!");
78 CouponHistory CouponHistory = CouponHistoryRepository.findById(id).orElseThrow( 60 CouponHistory couponHistory = this.couponHistoryRepository.findById(id).orElseThrow(
79 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", CouponHistory.class, id), 1)); 61 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", CouponHistory.class, id), 1));
80 CouponHistoryRepository.delete(CouponHistory); 62 this.couponHistoryRepository.delete(couponHistory);
81 } 63 }
82 64
83 @Override 65 @Override
84 public Long countByUserId(Long userId) { 66 public Long countByUserId(Long userId) {
85 return this.CouponHistoryRepository.countByUserId(userId); 67 return this.couponHistoryRepository.countByUserId(userId);
86 } 68 }
87 69
88 @Override 70 @Override
89 public Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now) { 71 public Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now) {
90 return this.CouponHistoryRepository.countByUserIdAndExpireTimeBefore(userId,now); 72 return this.couponHistoryRepository.countByUserIdAndExpireTimeBefore(userId,now);
91 } 73 }
92 74
93 @Override 75 @Override
94 public Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime) { 76 public Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime) {
95 return this.CouponHistoryRepository.countByUserIdAndExpireTimeBetween(userId,now,expireTime); 77 return this.couponHistoryRepository.countByUserIdAndExpireTimeBetween(userId,now,expireTime);
96 } 78 }
97 79
98
99 } 80 }
......
1 package com.topdraw.business.module.coupon.repository; 1 package com.topdraw.business.module.coupon.repository;
2 2
3 import com.topdraw.business.module.coupon.domain.Coupon; 3 import com.topdraw.business.module.coupon.domain.Coupon;
4 import com.topdraw.business.module.coupon.service.dto.CouponDTO;
4 import org.springframework.data.jpa.repository.JpaRepository; 5 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 6 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 7
8 import java.util.List;
7 import java.util.Optional; 9 import java.util.Optional;
8 10
9 /** 11 /**
...@@ -13,4 +15,7 @@ import java.util.Optional; ...@@ -13,4 +15,7 @@ import java.util.Optional;
13 public interface CouponRepository extends JpaRepository<Coupon, Long>, JpaSpecificationExecutor<Coupon> { 15 public interface CouponRepository extends JpaRepository<Coupon, Long>, JpaSpecificationExecutor<Coupon> {
14 16
15 Optional<Coupon> findFirstByCode(String code); 17 Optional<Coupon> findFirstByCode(String code);
18
19 List<CouponDTO> findByUserId(Long userId);
20
16 } 21 }
......
1 package com.topdraw.business.module.coupon.rest;
2
3 import com.topdraw.common.ResultInfo;
4 import com.topdraw.business.module.coupon.domain.Coupon;
5 import com.topdraw.business.module.coupon.service.CouponService;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.validation.annotation.Validated;
8 import org.springframework.web.bind.annotation.*;
9 import io.swagger.annotations.*;
10
11 /**
12 * @author XiangHan
13 * @date 2021-10-22
14 */
15 @Api(tags = "Coupon管理")
16 @RestController
17 @RequestMapping("/api/Coupon")
18 public class CouponController {
19
20 @Autowired
21 private CouponService CouponService;
22
23 @PostMapping(value = "/create")
24 @ApiOperation("新增Coupon")
25 public ResultInfo create(@Validated @RequestBody Coupon resources) {
26 CouponService.create(resources);
27 return ResultInfo.success();
28 }
29
30 @PutMapping(value = "/update")
31 @ApiOperation("修改Coupon")
32 public ResultInfo update(@Validated @RequestBody Coupon resources) {
33 CouponService.update(resources);
34 return ResultInfo.success();
35 }
36
37 @DeleteMapping(value = "/delete/{id}")
38 @ApiOperation("删除Coupon")
39 public ResultInfo delete(@PathVariable Long id) {
40 CouponService.delete(id);
41 return ResultInfo.success();
42 }
43
44 @GetMapping(value = "/getByCode/{code}")
45 @ApiOperation(value = "根据标识查询")
46 public ResultInfo getByCode(@PathVariable String code) {
47 return ResultInfo.success(CouponService.getByCode(code));
48 }
49 }
...@@ -2,9 +2,7 @@ package com.topdraw.business.module.coupon.service; ...@@ -2,9 +2,7 @@ package com.topdraw.business.module.coupon.service;
2 2
3 import com.topdraw.business.module.coupon.domain.Coupon; 3 import com.topdraw.business.module.coupon.domain.Coupon;
4 import com.topdraw.business.module.coupon.service.dto.CouponDTO; 4 import com.topdraw.business.module.coupon.service.dto.CouponDTO;
5 import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; 5
6 import org.springframework.data.domain.Pageable;
7 import java.util.Map;
8 import java.util.List; 6 import java.util.List;
9 7
10 /** 8 /**
...@@ -12,6 +10,14 @@ import java.util.List; ...@@ -12,6 +10,14 @@ import java.util.List;
12 * @date 2021-10-22 10 * @date 2021-10-22
13 */ 11 */
14 public interface CouponService { 12 public interface CouponService {
13
14 /**
15 * 根据ID查询
16 * @param userId ID
17 * @return CouponDTO
18 */
19 List<CouponDTO> findByUserId(Long userId);
20
15 /** 21 /**
16 * 根据ID查询 22 * 根据ID查询
17 * @param id ID 23 * @param id ID
...@@ -19,16 +25,12 @@ public interface CouponService { ...@@ -19,16 +25,12 @@ public interface CouponService {
19 */ 25 */
20 CouponDTO findById(Long id); 26 CouponDTO findById(Long id);
21 27
22 void create(Coupon resources);
23
24 void update(Coupon resources);
25
26 void delete(Long id);
27
28 /** 28 /**
29 * Code校验 29 * Code校验
30 * @param code 30 * @param code
31 * @return CouponDTO 31 * @return CouponDTO
32 */ 32 */
33 CouponDTO getByCode(String code); 33 CouponDTO getByCode(String code);
34
35
34 } 36 }
......
...@@ -14,69 +14,69 @@ import java.time.LocalDateTime; ...@@ -14,69 +14,69 @@ import java.time.LocalDateTime;
14 @Data 14 @Data
15 public class CouponDTO implements Serializable { 15 public class CouponDTO implements Serializable {
16 16
17 // id 17 /** id */
18 private Long id; 18 private Long id;
19 19
20 // 标识 20 /** 标识 */
21 private String code; 21 private String code;
22 22
23 // 名称 23 /** 名称 */
24 private String title; 24 private String title;
25 25
26 // 图片 26 /** 图片 */
27 private String images; 27 private String images;
28 28
29 // 发行量,-1代表不限量 29 /** 发行量,-1代表不限量 */
30 private Integer stock; 30 private Integer stock;
31 31
32 // 剩余量,-1代表不限量 32 /** 剩余量,-1代表不限量 */
33 private Integer remainStock; 33 private Integer remainStock;
34 34
35 // 优惠形式:1:现金;2:折扣 35 /** 优惠形式:1:现金;2:折扣 */
36 private Integer useType; 36 private Integer useType;
37 37
38 // 面额 38 /** 面额 */
39 private BigDecimal denomination; 39 private BigDecimal denomination;
40 40
41 // 折扣 41 /** 折扣 */
42 private BigDecimal discount; 42 private BigDecimal discount;
43 43
44 // 适用用户范围:1:新用户;2:全体用户 44 /** 适用用户范围:1:新用户;2:全体用户 */
45 private Integer userRange; 45 private Integer userRange;
46 46
47 // 限领次数 -1:无限次; >0:具体次数 47 /** 限领次数 -1:无限次; >0:具体次数 */
48 private Integer collectLimit; 48 private Integer collectLimit;
49 49
50 // 适用门槛:1:无门槛;2:满减形式 50 /** 适用门槛:1:无门槛;2:满减形式 */
51 private Integer thresholdType; 51 private Integer thresholdType;
52 52
53 // 满减门槛 53 /** 满减门槛 */
54 private BigDecimal amountThreshold; 54 private BigDecimal amountThreshold;
55 55
56 // 产品范围:1:全部商品;2:指定商品 56 /** 产品范围:1:全部商品;2:指定商品 */
57 private Integer itemRange; 57 private Integer itemRange;
58 58
59 // 生效形式:1:固定日期;2:相对日期 59 /** 生效形式:1:固定日期;2:相对日期 */
60 private Integer effectType; 60 private Integer effectType;
61 61
62 // 生效时间 62 /** 生效时间 */
63 private Timestamp startTime; 63 private Timestamp startTime;
64 64
65 // 过期时间 65 /** 过期时间 */
66 private LocalDateTime expireTime; 66 private LocalDateTime expireTime;
67 67
68 // 自领取当日,几天内有效 68 /** 自领取当日,几天内有效 */
69 private Integer validDays; 69 private Integer validDays;
70 70
71 // 使用说明 71 /** 使用说明 */
72 private String description; 72 private String description;
73 73
74 // 状态0:未开始,1:启用;2:停用 74 /** 状态0:未开始,1:启用;2:停用 */
75 private Integer status; 75 private Integer status;
76 76
77 // 创建时间 77 /** 创建时间 */
78 private Timestamp createTime; 78 private Timestamp createTime;
79 79
80 // 更新时间 80 /** 更新时间 */
81 private Timestamp updateTime; 81 private Timestamp updateTime;
82 } 82 }
......
1 package com.topdraw.business.module.coupon.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author XiangHan
7 * @date 2021-10-22
8 */
9 @Data
10 public class CouponQueryCriteria{
11 }
1 package com.topdraw.business.module.coupon.service.impl; 1 package com.topdraw.business.module.coupon.service.impl;
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.RedissonUtil; 4 import com.topdraw.exception.GlobeExceptionMsg;
5 import com.topdraw.utils.ValidationUtil; 5 import com.topdraw.utils.ValidationUtil;
6 import com.topdraw.business.module.coupon.repository.CouponRepository; 6 import com.topdraw.business.module.coupon.repository.CouponRepository;
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.coupon.service.mapper.CouponMapper; 9 import com.topdraw.business.module.coupon.service.mapper.CouponMapper;
10 import org.redisson.api.RLock;
11 import org.redisson.api.RedissonClient; 10 import org.redisson.api.RedissonClient;
12 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
14 import org.springframework.transaction.annotation.Propagation; 13 import org.springframework.transaction.annotation.Propagation;
15 import org.springframework.transaction.annotation.Transactional; 14 import org.springframework.transaction.annotation.Transactional;
16 import org.springframework.dao.EmptyResultDataAccessException;
17 import org.springframework.util.Assert; 15 import org.springframework.util.Assert;
18 import com.topdraw.utils.StringUtils; 16 import com.topdraw.utils.StringUtils;
19 17
18 import java.util.List;
19
20 20
21 /** 21 /**
22 * @author XiangHan 22 * @author XiangHan
...@@ -26,58 +26,29 @@ import com.topdraw.utils.StringUtils; ...@@ -26,58 +26,29 @@ import com.topdraw.utils.StringUtils;
26 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) 26 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
27 public class CouponServiceImpl implements CouponService { 27 public class CouponServiceImpl implements CouponService {
28 28
29 @Autowired
30 private CouponRepository CouponRepository;
31 29
32 @Autowired 30 @Autowired
33 private CouponMapper CouponMapper; 31 private CouponMapper couponMapper;
34
35 @Autowired 32 @Autowired
36 private RedissonClient redissonClient; 33 private CouponRepository couponRepository;
37 34
38 @Override 35 @Override
39 public CouponDTO findById(Long id) { 36 public List<CouponDTO> findByUserId(Long userId) {
40 Coupon Coupon = CouponRepository.findById(id).orElseGet(Coupon::new); 37 List<CouponDTO> couponDTOList = this.couponRepository.findByUserId(userId);
41 ValidationUtil.isNull(Coupon.getId(),"Coupon","id",id); 38 return couponDTOList;
42 return CouponMapper.toDto(Coupon);
43 } 39 }
44 40
45 @Override 41 @Override
46 @Transactional(rollbackFor = Exception.class) 42 public CouponDTO findById(Long id) {
47 public void create(Coupon resources) { 43 Assert.notNull(id, GlobeExceptionMsg.COUPON_ID_IS_NULL);
48 CouponRepository.save(resources); 44 Coupon Coupon = this.couponRepository.findById(id).orElseGet(Coupon::new);
49 } 45 ValidationUtil.isNull(Coupon.getId(),"Coupon","id",id);
50 46 return this.couponMapper.toDto(Coupon);
51 @Override
52 @Transactional(rollbackFor = Exception.class)
53 public void update(Coupon resources) {
54 RLock rLock = this.redissonClient.getLock(resources.getId().toString());
55 try {
56 RedissonUtil.lock(rLock);
57 Coupon Coupon = CouponRepository.findById(resources.getId()).orElseGet(Coupon::new);
58 ValidationUtil.isNull( Coupon.getId(),"Coupon","id",resources.getId());
59 Coupon.copy(resources);
60 CouponRepository.save(Coupon);
61 } catch (Exception e) {
62 e.printStackTrace();
63 throw e;
64 } finally {
65 RedissonUtil.unlock(rLock);
66 }
67 }
68
69 @Override
70 @Transactional(rollbackFor = Exception.class)
71 public void delete(Long id) {
72 Assert.notNull(id, "The given id must not be null!");
73 Coupon Coupon = CouponRepository.findById(id).orElseThrow(
74 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", Coupon.class, id), 1));
75 CouponRepository.delete(Coupon);
76 } 47 }
77 48
78 @Override 49 @Override
79 public CouponDTO getByCode(String code) { 50 public CouponDTO getByCode(String code) {
80 return StringUtils.isNotEmpty(code) ? CouponMapper.toDto(CouponRepository.findFirstByCode(code).orElseGet(Coupon::new)) 51 return StringUtils.isNotEmpty(code) ? this.couponMapper.toDto(this.couponRepository.findFirstByCode(code).orElseGet(Coupon::new))
81 : new CouponDTO(); 52 : new CouponDTO();
82 } 53 }
83 } 54 }
......
...@@ -23,70 +23,70 @@ import java.io.Serializable; ...@@ -23,70 +23,70 @@ import java.io.Serializable;
23 @Table(name="uc_exp_detail") 23 @Table(name="uc_exp_detail")
24 public class ExpDetail implements Serializable { 24 public class ExpDetail implements Serializable {
25 25
26 // 主键 26 /** 主键 */
27 @Id 27 @Id
28 @GeneratedValue(strategy = GenerationType.IDENTITY) 28 @GeneratedValue(strategy = GenerationType.IDENTITY)
29 @Column(name = "id") 29 @Column(name = "id")
30 private Long id; 30 private Long id;
31 31
32 // 标识 32 /** 标识 */
33 @Column(name = "code", nullable = false) 33 @Column(name = "code", nullable = false)
34 private String code; 34 private String code;
35 35
36 // 应用code 36 /** 应用code */
37 @Column(name = "app_code") 37 @Column(name = "app_code")
38 private String appCode; 38 private String appCode;
39 39
40 // 会员id 40 /** 会员id */
41 @Column(name = "member_id", nullable = false) 41 @Column(name = "member_id", nullable = false)
42 private Long memberId; 42 private Long memberId;
43 43
44 // 账号id 44 /** 账号id */
45 @Column(name = "account_id") 45 @Column(name = "account_id")
46 private Long accountId; 46 private Long accountId;
47 47
48 // 原始成长值 48 /** 原始成长值 */
49 @Column(name = "original_exp", nullable = false) 49 @Column(name = "original_exp", nullable = false)
50 private Long originalExp; 50 private Long originalExp;
51 51
52 // 结果成长值 52 /** 结果成长值 */
53 @Column(name = "result_exp", nullable = false) 53 @Column(name = "result_exp", nullable = false)
54 private Long resultExp; 54 private Long resultExp;
55 55
56 // 成长值变化,一般为正数 56 /** 成长值变化,一般为正数 */
57 @Column(name = "exp", nullable = false) 57 @Column(name = "exp", nullable = false)
58 private Long exp; 58 private Long exp;
59 59
60 // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) 60 /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */
61 @Column(name = "device_type", nullable = false) 61 @Column(name = "device_type", nullable = false)
62 private Integer deviceType; 62 private Integer deviceType;
63 63
64 // 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 64 /** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 */
65 @Column(name = "evt_type", nullable = false) 65 @Column(name = "evt_type", nullable = false)
66 private Integer evtType; 66 private Integer evtType;
67 67
68 // 订单id(针对订购操作) 68 /** 订单id(针对订购操作) */
69 @Column(name = "order_id") 69 @Column(name = "order_id")
70 private Long orderId; 70 private Long orderId;
71 71
72 // 节目id(针对观影操作) 72 /** 节目id(针对观影操作) */
73 @Column(name = "media_id") 73 @Column(name = "media_id")
74 private Long mediaId; 74 private Long mediaId;
75 75
76 // 活动id(针对参与活动) 76 /** 活动id(针对参与活动) */
77 @Column(name = "activity_id") 77 @Column(name = "activity_id")
78 private Long activityId; 78 private Long activityId;
79 79
80 // 成长值变化描述,用于管理侧显示 80 /** 成长值变化描述,用于管理侧显示 */
81 @Column(name = "description", nullable = false) 81 @Column(name = "description", nullable = false)
82 private String description; 82 private String description;
83 83
84 // 创建时间 84 /** 创建时间 */
85 @CreatedDate 85 @CreatedDate
86 @Column(name = "create_time") 86 @Column(name = "create_time")
87 private Timestamp createTime; 87 private Timestamp createTime;
88 88
89 // 更新时间 89 /** 更新时间 */
90 @LastModifiedDate 90 @LastModifiedDate
91 @Column(name = "update_time") 91 @Column(name = "update_time")
92 private Timestamp updateTime; 92 private Timestamp updateTime;
......
1 package com.topdraw.business.module.exp.detail.domain;
2
3 import com.topdraw.exception.GlobeExceptionMsg;
4 import org.apache.commons.lang3.StringUtils;
5 import org.springframework.util.Assert;
6
7 import java.util.Objects;
8
9 public class ExpDetailBuilder {
10
11 public static ExpDetail build(Long memberId, Long originalExp, Long resultExp,
12 Integer deviceType, Integer evtType){
13 ExpDetail expDetail = new ExpDetail();
14 expDetail.setMemberId(memberId);
15 expDetail.setOriginalExp(originalExp);
16 expDetail.setResultExp(resultExp);
17 expDetail.setDeviceType(deviceType);
18 expDetail.setEvtType(evtType);
19 return build(expDetail);
20 }
21
22 public static ExpDetail build(ExpDetail expDetail){
23 return build(expDetail.getId(),
24 expDetail.getCode(),
25 expDetail.getAppCode(),
26 expDetail.getMemberId(),
27 expDetail.getAccountId(),
28 expDetail.getOriginalExp(),expDetail.getResultExp(),
29 expDetail.getExp(),expDetail.getDeviceType(),
30 expDetail.getEvtType(), expDetail.getOrderId(), expDetail.getMediaId(),
31 expDetail.getActivityId(),expDetail.getDescription());
32 }
33
34 public static ExpDetail build(Long id, String code,
35 String appCode, Long memberId, Long accountId,
36 Long originalExp, Long resultExp, Long exp,
37 Integer deviceType, Integer evtType, Long orderId,
38 Long mediaId, Long activityId, String description){
39 Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL);
40
41 ExpDetail expDetail = new ExpDetail();
42 expDetail.setId(Objects.isNull(id)?null:id);
43 expDetail.setCode(StringUtils.isBlank(code)?null:code);
44 expDetail.setAppCode(StringUtils.isBlank(appCode)?null:appCode);
45 expDetail.setMemberId(Objects.isNull(memberId)?null:memberId);
46 expDetail.setAccountId(Objects.isNull(accountId)?null:accountId);
47 expDetail.setOriginalExp(Objects.isNull(originalExp)?0:originalExp);
48 expDetail.setResultExp(Objects.isNull(resultExp)?0:resultExp);
49 expDetail.setExp(Objects.isNull(exp)?0:exp);
50 expDetail.setDeviceType(Objects.isNull(deviceType)?null:deviceType);
51 expDetail.setEvtType(Objects.isNull(evtType)?null:evtType);
52 expDetail.setOrderId(Objects.isNull(orderId)?null:orderId);
53 expDetail.setMediaId(Objects.isNull(mediaId)?null:mediaId);
54 expDetail.setActivityId(Objects.isNull(activityId)?null:activityId);
55 expDetail.setDescription(StringUtils.isBlank(description)?null:description);
56 return expDetail;
57 }
58
59 }
1 package com.topdraw.business.module.exp.detail.rest;
2
3 import com.topdraw.common.ResultInfo;
4 import com.topdraw.business.module.exp.detail.domain.ExpDetail;
5 import com.topdraw.business.module.exp.detail.service.ExpDetailService;
6 import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.data.domain.Pageable;
9 import org.springframework.validation.annotation.Validated;
10 import org.springframework.web.bind.annotation.*;
11 import io.swagger.annotations.*;
12
13 /**
14 * @author XiangHan
15 * @date 2021-10-22
16 */
17 @Api(tags = "ExpDetail管理")
18 @RestController
19 @RequestMapping("/api/ExpDetail")
20 public class ExpDetailController {
21
22 @Autowired
23 private ExpDetailService ExpDetailService;
24
25 @GetMapping
26 @ApiOperation("查询ExpDetail")
27 public ResultInfo getExpDetails(ExpDetailQueryCriteria criteria, Pageable pageable) {
28 return ResultInfo.successPage(ExpDetailService.queryAll(criteria,pageable));
29 }
30
31 @GetMapping(value = "/all")
32 @ApiOperation("查询所有ExpDetail")
33 public ResultInfo getExpDetails(ExpDetailQueryCriteria criteria) {
34 return ResultInfo.success(ExpDetailService.queryAll(criteria));
35 }
36
37 @PostMapping(value = "/create")
38 @ApiOperation("新增ExpDetail")
39 public ResultInfo create(@Validated @RequestBody ExpDetail resources) {
40 ExpDetailService.create(resources);
41 return ResultInfo.success();
42 }
43
44 @PutMapping(value = "/update")
45 @ApiOperation("修改ExpDetail")
46 public ResultInfo update(@Validated @RequestBody ExpDetail resources) {
47 ExpDetailService.update(resources);
48 return ResultInfo.success();
49 }
50
51 @DeleteMapping(value = "/delete/{id}")
52 @ApiOperation("删除ExpDetail")
53 public ResultInfo delete(@PathVariable Long id) {
54 ExpDetailService.delete(id);
55 return ResultInfo.success();
56 }
57
58 @GetMapping(value = "/getByCode/{code}")
59 @ApiOperation(value = "根据标识查询")
60 public ResultInfo getByCode(@PathVariable String code) {
61 return ResultInfo.success(ExpDetailService.getByCode(code));
62 }
63 }
...@@ -2,10 +2,6 @@ package com.topdraw.business.module.exp.detail.service; ...@@ -2,10 +2,6 @@ package com.topdraw.business.module.exp.detail.service;
2 2
3 import com.topdraw.business.module.exp.detail.domain.ExpDetail; 3 import com.topdraw.business.module.exp.detail.domain.ExpDetail;
4 import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; 4 import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO;
5 import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria;
6 import org.springframework.data.domain.Pageable;
7 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 ExpDetailService { 10 public interface ExpDetailService {
15 11
16 /** 12 /**
17 * 查询数据分页
18 * @param criteria 条件参数
19 * @param pageable 分页参数
20 * @return Map<String,Object>
21 */
22 Map<String,Object> queryAll(ExpDetailQueryCriteria criteria, Pageable pageable);
23
24 /**
25 * 查询所有数据不分页
26 * @param criteria 条件参数
27 * @return List<ExpDetailDTO>
28 */
29 List<ExpDetailDTO> queryAll(ExpDetailQueryCriteria criteria);
30
31 /**
32 * 根据ID查询 13 * 根据ID查询
33 * @param id ID 14 * @param id ID
34 * @return ExpDetailDTO 15 * @return ExpDetailDTO
35 */ 16 */
36 ExpDetailDTO findById(Long id); 17 ExpDetailDTO findById(Long id);
37 18
19 /**
20 *
21 * @param resources
22 */
38 void create(ExpDetail resources); 23 void create(ExpDetail resources);
39 24
25 /**
26 *
27 * @param resources
28 */
40 void update(ExpDetail resources); 29 void update(ExpDetail resources);
41 30
31 /**
32 *
33 * @param id
34 */
42 void delete(Long id); 35 void delete(Long id);
43 36
44 /** 37 /**
......
...@@ -12,51 +12,51 @@ import java.io.Serializable; ...@@ -12,51 +12,51 @@ import java.io.Serializable;
12 @Data 12 @Data
13 public class ExpDetailDTO implements Serializable { 13 public class ExpDetailDTO implements Serializable {
14 14
15 // 主键 15 /** 主键 */
16 private Long id; 16 private Long id;
17 17
18 // 标识 18 /** 标识 */
19 private String code; 19 private String code;
20 20
21 // 应用code 21 /** 应用code */
22 private String appCode; 22 private String appCode;
23 23
24 // 会员id 24 /** 会员id */
25 private Long memberId; 25 private Long memberId;
26 26
27 // 账号id 27 /** 账号id */
28 private Long accountId; 28 private Long accountId;
29 29
30 // 原始成长值 30 /** 原始成长值 */
31 private Long originalExp; 31 private Long originalExp;
32 32
33 // 结果成长值 33 /** 结果成长值 */
34 private Long resultExp; 34 private Long resultExp;
35 35
36 // 成长值变化,一般为正数 36 /** 成长值变化,一般为正数 */
37 private Long exp; 37 private Long exp;
38 38
39 // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) 39 /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */
40 private Integer deviceType; 40 private Integer deviceType;
41 41
42 // 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 42 /** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 */
43 private Integer evtType; 43 private Integer evtType;
44 44
45 // 订单id(针对订购操作) 45 /** 订单id(针对订购操作) */
46 private Long orderId; 46 private Long orderId;
47 47
48 // 节目id(针对观影操作) 48 /** 节目id(针对观影操作) */
49 private Long mediaId; 49 private Long mediaId;
50 50
51 // 活动id(针对参与活动) 51 /** 活动id(针对参与活动) */
52 private Long activityId; 52 private Long activityId;
53 53
54 // 成长值变化描述,用于管理侧显示 54 /** 成长值变化描述,用于管理侧显示 */
55 private String description; 55 private String description;
56 56
57 // 创建时间 57 /** 创建时间 */
58 private Timestamp createTime; 58 private Timestamp createTime;
59 59
60 // 更新时间 60 /** 更新时间 */
61 private Timestamp updateTime; 61 private Timestamp updateTime;
62 } 62 }
......
1 package com.topdraw.business.module.exp.detail.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author XiangHan
7 * @date 2021-10-22
8 */
9 @Data
10 public class ExpDetailQueryCriteria{
11 }
1 package com.topdraw.business.module.exp.detail.service.impl; 1 package com.topdraw.business.module.exp.detail.service.impl;
2 2
3 import com.topdraw.business.module.exp.detail.domain.ExpDetail; 3 import com.topdraw.business.module.exp.detail.domain.ExpDetail;
4 import com.topdraw.business.module.exp.detail.domain.ExpDetailBuilder;
4 import com.topdraw.utils.ValidationUtil; 5 import com.topdraw.utils.ValidationUtil;
5 import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository; 6 import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository;
6 import com.topdraw.business.module.exp.detail.service.ExpDetailService; 7 import com.topdraw.business.module.exp.detail.service.ExpDetailService;
7 import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; 8 import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO;
8 import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria;
9 import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper; 9 import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper;
10 import org.redisson.api.RLock; 10 import org.redisson.api.RLock;
11 import org.redisson.api.RedissonClient; 11 import org.redisson.api.RedissonClient;
...@@ -14,15 +14,9 @@ import org.springframework.stereotype.Service; ...@@ -14,15 +14,9 @@ import org.springframework.stereotype.Service;
14 import org.springframework.transaction.annotation.Propagation; 14 import org.springframework.transaction.annotation.Propagation;
15 import org.springframework.transaction.annotation.Transactional; 15 import org.springframework.transaction.annotation.Transactional;
16 import org.springframework.dao.EmptyResultDataAccessException; 16 import org.springframework.dao.EmptyResultDataAccessException;
17 import org.springframework.data.domain.Page;
18 import org.springframework.data.domain.Pageable;
19 import org.springframework.util.Assert; 17 import org.springframework.util.Assert;
20 import com.topdraw.utils.PageUtil;
21 import com.topdraw.utils.QueryHelp;
22 import com.topdraw.utils.StringUtils; 18 import com.topdraw.utils.StringUtils;
23 19
24 import java.util.List;
25 import java.util.Map;
26 20
27 /** 21 /**
28 * @author XiangHan 22 * @author XiangHan
...@@ -33,36 +27,25 @@ import java.util.Map; ...@@ -33,36 +27,25 @@ import java.util.Map;
33 public class ExpDetailServiceImpl implements ExpDetailService { 27 public class ExpDetailServiceImpl implements ExpDetailService {
34 28
35 @Autowired 29 @Autowired
36 private ExpDetailRepository ExpDetailRepository; 30 private ExpDetailRepository expDetailRepository;
37
38 @Autowired 31 @Autowired
39 private ExpDetailMapper ExpDetailMapper; 32 private ExpDetailMapper expDetailMapper;
40 33
41 @Autowired 34 @Autowired
42 private RedissonClient redissonClient; 35 private RedissonClient redissonClient;
43 36
44 @Override 37 @Override
45 public Map<String, Object> queryAll(ExpDetailQueryCriteria criteria, Pageable pageable) {
46 Page<ExpDetail> page = ExpDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
47 return PageUtil.toPage(page.map(ExpDetailMapper::toDto));
48 }
49
50 @Override
51 public List<ExpDetailDTO> queryAll(ExpDetailQueryCriteria criteria) {
52 return ExpDetailMapper.toDto(ExpDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
53 }
54
55 @Override
56 public ExpDetailDTO findById(Long id) { 38 public ExpDetailDTO findById(Long id) {
57 ExpDetail ExpDetail = ExpDetailRepository.findById(id).orElseGet(ExpDetail::new); 39 ExpDetail ExpDetail = this.expDetailRepository.findById(id).orElseGet(ExpDetail::new);
58 ValidationUtil.isNull(ExpDetail.getId(),"ExpDetail","id",id); 40 ValidationUtil.isNull(ExpDetail.getId(),"ExpDetail","id",id);
59 return ExpDetailMapper.toDto(ExpDetail); 41 return this.expDetailMapper.toDto(ExpDetail);
60 } 42 }
61 43
62 @Override 44 @Override
63 @Transactional(rollbackFor = Exception.class) 45 @Transactional(rollbackFor = Exception.class)
64 public void create(ExpDetail resources) { 46 public void create(ExpDetail resources) {
65 ExpDetailRepository.save(resources); 47 ExpDetail expDetail = ExpDetailBuilder.build(resources);
48 this.expDetailRepository.save(expDetail);
66 } 49 }
67 50
68 @Override 51 @Override
...@@ -70,10 +53,10 @@ public class ExpDetailServiceImpl implements ExpDetailService { ...@@ -70,10 +53,10 @@ public class ExpDetailServiceImpl implements ExpDetailService {
70 public void update(ExpDetail resources) { 53 public void update(ExpDetail resources) {
71 RLock rLock = this.redissonClient.getLock(resources.getId().toString()); 54 RLock rLock = this.redissonClient.getLock(resources.getId().toString());
72 try { 55 try {
73 ExpDetail ExpDetail = ExpDetailRepository.findById(resources.getId()).orElseGet(ExpDetail::new); 56 ExpDetail ExpDetail = this.expDetailRepository.findById(resources.getId()).orElseGet(ExpDetail::new);
74 ValidationUtil.isNull( ExpDetail.getId(),"ExpDetail","id",resources.getId()); 57 ValidationUtil.isNull( ExpDetail.getId(),"ExpDetail","id",resources.getId());
75 ExpDetail.copy(resources); 58 ExpDetail.copy(resources);
76 ExpDetailRepository.save(ExpDetail); 59 this.expDetailRepository.save(ExpDetail);
77 } catch (Exception e) { 60 } catch (Exception e) {
78 e.printStackTrace(); 61 e.printStackTrace();
79 throw e; 62 throw e;
...@@ -86,14 +69,14 @@ public class ExpDetailServiceImpl implements ExpDetailService { ...@@ -86,14 +69,14 @@ public class ExpDetailServiceImpl implements ExpDetailService {
86 @Transactional(rollbackFor = Exception.class) 69 @Transactional(rollbackFor = Exception.class)
87 public void delete(Long id) { 70 public void delete(Long id) {
88 Assert.notNull(id, "The given id must not be null!"); 71 Assert.notNull(id, "The given id must not be null!");
89 ExpDetail ExpDetail = ExpDetailRepository.findById(id).orElseThrow( 72 ExpDetail ExpDetail = this.expDetailRepository.findById(id).orElseThrow(
90 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ExpDetail.class, id), 1)); 73 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ExpDetail.class, id), 1));
91 ExpDetailRepository.delete(ExpDetail); 74 this.expDetailRepository.delete(ExpDetail);
92 } 75 }
93 76
94 @Override 77 @Override
95 public ExpDetailDTO getByCode(String code) { 78 public ExpDetailDTO getByCode(String code) {
96 return StringUtils.isNotEmpty(code) ? ExpDetailMapper.toDto(ExpDetailRepository.findFirstByCode(code).orElseGet(ExpDetail::new)) 79 return StringUtils.isNotEmpty(code) ? this.expDetailMapper.toDto(this.expDetailRepository.findFirstByCode(code).orElseGet(ExpDetail::new))
97 : new ExpDetailDTO(); 80 : new ExpDetailDTO();
98 } 81 }
99 } 82 }
......
1 package com.topdraw.business.module.exp.history.domain;
2
3 import com.topdraw.exception.GlobeExceptionMsg;
4 import com.topdraw.util.IdWorker;
5 import org.apache.commons.lang3.StringUtils;
6 import org.springframework.util.Assert;
7
8 import java.util.Objects;
9
10 public class ExpHistoryBuilder {
11
12 public ExpHistory build(Long memberId, Long originalExp, Long resultExp, Long exp,Integer deviceType , Integer evtType) {
13 ExpHistory expHistory = new ExpHistory();
14 expHistory.setMemberId(memberId);
15 expHistory.setOriginalExp(originalExp);
16 expHistory.setResultExp(resultExp);
17 expHistory.setDeviceType(deviceType);
18 expHistory.setEvtType(evtType);
19 expHistory.setExp(exp);
20 return build(expHistory);
21 }
22
23 public ExpHistory build(ExpHistory expHistory) {
24 return build(expHistory.getId(),expHistory.getCode(),
25 expHistory.getMemberId(),expHistory.getAccountId(),
26 expHistory.getOriginalExp(),expHistory.getResultExp(),expHistory.getExp(),
27 expHistory.getDeviceType(),expHistory.getEvtType(),expHistory.getOrderId(),
28 expHistory.getMediaId(),expHistory.getActivityId(),expHistory.getDescription());
29 }
30
31 public ExpHistory build(Long id,String code,Long memberId,Long accountId,
32 Long originalExp,Long resultExp,Long exp,
33 Integer deviceType,Integer evtType,Long orderId,
34 Long mediaId,Long activityId,String description) {
35
36 Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL);
37
38 ExpHistory expHistory = new ExpHistory();
39 expHistory.setId(Objects.isNull(id)?null:id);
40 expHistory.setCode(StringUtils.isBlank(code)? IdWorker.generatorCode("exp") :code);
41 expHistory.setMemberId(memberId);
42 expHistory.setAccountId(Objects.isNull(accountId)?null:accountId);
43 expHistory.setOriginalExp(Objects.isNull(originalExp)?0L:originalExp);
44 expHistory.setResultExp(Objects.isNull(resultExp)?0L:resultExp);
45 expHistory.setExp(Objects.isNull(exp)?0L:exp);
46 expHistory.setDeviceType(Objects.isNull(deviceType)?4:deviceType);
47 expHistory.setEvtType(Objects.isNull(evtType)?98:evtType);
48 expHistory.setOrderId(Objects.isNull(orderId)?null:orderId);
49 expHistory.setMediaId(Objects.isNull(mediaId)?null:mediaId);
50 expHistory.setActivityId(Objects.isNull(activityId)?null:activityId);
51 expHistory.setDescription(StringUtils.isBlank(description)?null:description);
52 return expHistory;
53 }
54
55
56 }
...@@ -19,12 +19,12 @@ public interface ExpHistoryService { ...@@ -19,12 +19,12 @@ public interface ExpHistoryService {
19 */ 19 */
20 ExpHistoryDTO findById(Long id); 20 ExpHistoryDTO findById(Long id);
21 21
22 /**
23 *
24 * @param resources
25 */
22 void create(ExpHistory resources); 26 void create(ExpHistory resources);
23 27
24 void update(ExpHistory resources);
25
26 void delete(Long id);
27
28 /** 28 /**
29 * Code校验 29 * Code校验
30 * @param code 30 * @param code
......
...@@ -10,8 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,8 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
11 import org.springframework.transaction.annotation.Propagation; 11 import org.springframework.transaction.annotation.Propagation;
12 import org.springframework.transaction.annotation.Transactional; 12 import org.springframework.transaction.annotation.Transactional;
13 import org.springframework.dao.EmptyResultDataAccessException;
14 import org.springframework.util.Assert;
15 import com.topdraw.utils.StringUtils; 13 import com.topdraw.utils.StringUtils;
16 14
17 15
...@@ -24,45 +22,28 @@ import com.topdraw.utils.StringUtils; ...@@ -24,45 +22,28 @@ import com.topdraw.utils.StringUtils;
24 public class ExpHistoryServiceImpl implements ExpHistoryService { 22 public class ExpHistoryServiceImpl implements ExpHistoryService {
25 23
26 @Autowired 24 @Autowired
27 private ExpHistoryRepository ExpHistoryRepository; 25 private ExpHistoryMapper expHistoryMapper;
28
29 @Autowired 26 @Autowired
30 private ExpHistoryMapper ExpHistoryMapper; 27 private ExpHistoryRepository expHistoryRepository;
28
31 29
32 @Override 30 @Override
33 public ExpHistoryDTO findById(Long id) { 31 public ExpHistoryDTO findById(Long id) {
34 ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseGet(ExpHistory::new); 32 ExpHistory ExpHistory = this.expHistoryRepository.findById(id).orElseGet(ExpHistory::new);
35 ValidationUtil.isNull(ExpHistory.getId(),"ExpHistory","id",id); 33 ValidationUtil.isNull(ExpHistory.getId(),"ExpHistory","id",id);
36 return ExpHistoryMapper.toDto(ExpHistory); 34 return this.expHistoryMapper.toDto(ExpHistory);
37 } 35 }
38 36
39 @Override 37 @Override
40 @Transactional(rollbackFor = Exception.class) 38 @Transactional(rollbackFor = Exception.class)
41 public void create(ExpHistory resources) { 39 public void create(ExpHistory resources) {
42 ExpHistoryRepository.save(resources); 40 this.expHistoryRepository.save(resources);
43 } 41 }
44 42
45 @Override
46 @Transactional(rollbackFor = Exception.class)
47 public void update(ExpHistory resources) {
48 ExpHistory ExpHistory = ExpHistoryRepository.findById(resources.getId()).orElseGet(ExpHistory::new);
49 ValidationUtil.isNull( ExpHistory.getId(),"ExpHistory","id",resources.getId());
50 ExpHistory.copy(resources);
51 ExpHistoryRepository.save(ExpHistory);
52 }
53
54 @Override
55 @Transactional(rollbackFor = Exception.class)
56 public void delete(Long id) {
57 Assert.notNull(id, "The given id must not be null!");
58 ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseThrow(
59 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ExpHistory.class, id), 1));
60 ExpHistoryRepository.delete(ExpHistory);
61 }
62 43
63 @Override 44 @Override
64 public ExpHistoryDTO getByCode(String code) { 45 public ExpHistoryDTO getByCode(String code) {
65 return StringUtils.isNotEmpty(code) ? ExpHistoryMapper.toDto(ExpHistoryRepository.findFirstByCode(code).orElseGet(ExpHistory::new)) 46 return StringUtils.isNotEmpty(code) ? this.expHistoryMapper.toDto(this.expHistoryRepository.findFirstByCode(code).orElseGet(ExpHistory::new))
66 : new ExpHistoryDTO(); 47 : new ExpHistoryDTO();
67 } 48 }
68 } 49 }
......
1 package com.topdraw.business.module.member.address.domain; 1 package com.topdraw.business.module.member.address.domain;
2 2
3 import com.topdraw.business.module.member.domain.Member; 3 import com.topdraw.business.module.member.domain.Member;
4 import com.topdraw.exception.GlobeExceptionMsg;
4 import org.apache.commons.lang3.StringUtils; 5 import org.apache.commons.lang3.StringUtils;
6 import org.springframework.util.Assert;
5 7
6 import java.util.Objects; 8 import java.util.Objects;
7 9
...@@ -83,6 +85,7 @@ public class MemberAddressBuilder { ...@@ -83,6 +85,7 @@ public class MemberAddressBuilder {
83 String contactor,String cellphone, 85 String contactor,String cellphone,
84 String country,String province,String city, 86 String country,String province,String city,
85 String district,String address,String zipCode){ 87 String district,String address,String zipCode){
88 Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL);
86 89
87 MemberAddress memberAddress = new MemberAddress(); 90 MemberAddress memberAddress = new MemberAddress();
88 memberAddress.setId(Objects.nonNull(id)?null:id); 91 memberAddress.setId(Objects.nonNull(id)?null:id);
...@@ -108,12 +111,8 @@ public class MemberAddressBuilder { ...@@ -108,12 +111,8 @@ public class MemberAddressBuilder {
108 111
109 } 112 }
110 113
111
112 private static String stringIsNull(String s){ 114 private static String stringIsNull(String s){
113 return StringUtils.isBlank(s)?"":s; 115 return StringUtils.isBlank(s)?"":s;
114 } 116 }
115 117
116 private static Object objectIsNull(Object s){
117 return Objects.nonNull(s)?null:s;
118 }
119 } 118 }
......
1 package com.topdraw.business.module.member.address.service.impl; 1 package com.topdraw.business.module.member.address.service.impl;
2 2
3 import com.topdraw.aspect.AsyncMqSend;
4 import com.topdraw.business.module.member.address.domain.MemberAddress; 3 import com.topdraw.business.module.member.address.domain.MemberAddress;
5 import com.topdraw.business.module.member.address.domain.MemberAddressBuilder; 4 import com.topdraw.business.module.member.address.domain.MemberAddressBuilder;
6 import com.topdraw.business.module.member.service.MemberService; 5 import com.topdraw.business.module.member.service.MemberService;
......
...@@ -10,8 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,8 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
11 import org.springframework.transaction.annotation.Propagation; 11 import org.springframework.transaction.annotation.Propagation;
12 import org.springframework.transaction.annotation.Transactional; 12 import org.springframework.transaction.annotation.Transactional;
13 import org.springframework.dao.EmptyResultDataAccessException;
14 import org.springframework.util.Assert;
15 13
16 import java.util.List; 14 import java.util.List;
17 15
......
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.member.domain.Member; 3 import com.topdraw.business.module.member.domain.Member;
4 import com.topdraw.exception.GlobeExceptionMsg;
4 import org.apache.commons.lang3.StringUtils; 5 import org.apache.commons.lang3.StringUtils;
6 import org.springframework.util.Assert;
5 7
6 import java.util.Objects; 8 import java.util.Objects;
7 9
...@@ -36,8 +38,7 @@ public class MemberProfileBuilder { ...@@ -36,8 +38,7 @@ public class MemberProfileBuilder {
36 String email, String description, String phone, String constellation, 38 String email, String description, String phone, String constellation,
37 String birthday) { 39 String birthday) {
38 40
39 if (memberId == null) 41 Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL);
40 throw new NullPointerException("memberId is null");
41 42
42 MemberProfile memberProfile = new MemberProfile(); 43 MemberProfile memberProfile = new MemberProfile();
43 memberProfile.setMemberId(memberId); 44 memberProfile.setMemberId(memberId);
......
1 package com.topdraw.business.module.member.profile.service.impl; 1 package com.topdraw.business.module.member.profile.service.impl;
2 2
3 import com.topdraw.aspect.AsyncMqSend;
4 import com.topdraw.business.module.member.domain.Member; 3 import com.topdraw.business.module.member.domain.Member;
5 import com.topdraw.business.module.member.profile.domain.MemberProfile; 4 import com.topdraw.business.module.member.profile.domain.MemberProfile;
6 import com.topdraw.business.module.member.profile.domain.MemberProfileBuilder; 5 import com.topdraw.business.module.member.profile.domain.MemberProfileBuilder;
......
1 package com.topdraw.business.module.member.relatedinfo.domain; 1 package com.topdraw.business.module.member.relatedinfo.domain;
2 2
3 import com.topdraw.business.module.member.domain.Member; 3 import com.topdraw.business.module.member.domain.Member;
4 import com.topdraw.exception.GlobeExceptionMsg;
4 import org.apache.commons.lang3.StringUtils; 5 import org.apache.commons.lang3.StringUtils;
6 import org.springframework.util.Assert;
5 7
6 import java.time.LocalDate; 8 import java.time.LocalDate;
7 import java.util.Objects; 9 import java.util.Objects;
...@@ -32,6 +34,9 @@ public class MemberRelatedInfoBuilder { ...@@ -32,6 +34,9 @@ public class MemberRelatedInfoBuilder {
32 34
33 public static MemberRelatedInfo build(Long memberId , String memberCode , Long id , String name , Integer sex , 35 public static MemberRelatedInfo build(Long memberId , String memberCode , Long id , String name , Integer sex ,
34 String cellphone , String idCard, LocalDate birthday , String avatarUrl , Integer type){ 36 String cellphone , String idCard, LocalDate birthday , String avatarUrl , Integer type){
37
38 Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL);
39
35 MemberRelatedInfo memberRelatedInfo = new MemberRelatedInfo(); 40 MemberRelatedInfo memberRelatedInfo = new MemberRelatedInfo();
36 memberRelatedInfo.setMemberId(memberId); 41 memberRelatedInfo.setMemberId(memberId);
37 memberRelatedInfo.setMemberCode(memberCode); 42 memberRelatedInfo.setMemberCode(memberCode);
......
...@@ -35,12 +35,13 @@ public class MemberServiceImpl implements MemberService { ...@@ -35,12 +35,13 @@ public class MemberServiceImpl implements MemberService {
35 @Autowired 35 @Autowired
36 private MemberMapper memberMapper; 36 private MemberMapper memberMapper;
37 @Autowired 37 @Autowired
38 private RedissonClient redissonClient;
39 @Autowired
40 private MemberRepository memberRepository; 38 private MemberRepository memberRepository;
41 @Autowired 39 @Autowired
42 private MemberProfileService memberProfileService; 40 private MemberProfileService memberProfileService;
43 41
42 @Autowired
43 private RedissonClient redissonClient;
44
44 @Override 45 @Override
45 public MemberDTO findById(Long id) { 46 public MemberDTO findById(Long id) {
46 47
......
1 package com.topdraw.business.module.member.viphistory.domain;
2
3 import com.topdraw.business.module.member.domain.Member;
4
5 import java.time.LocalDateTime;
6 import java.util.Objects;
7
8 public class MemberVipHistoryBuilder {
9
10 public static MemberVipHistory build(Member member , Integer beforeVip) {
11 Long id = member.getId();
12 Integer vip = member.getVip();
13 LocalDateTime vipExpireTime = member.getVipExpireTime();
14
15 MemberVipHistory memberVipHistory = new MemberVipHistory();
16 memberVipHistory.setMemberId(Objects.isNull(id)? null:id);
17 memberVipHistory.setVip(Objects.isNull(vip)? null:vip);
18 memberVipHistory.setBeforeVip(Objects.isNull(beforeVip)? null:beforeVip);
19 memberVipHistory.setVipExpireTime(Objects.isNull(vipExpireTime)? null:vipExpireTime);
20 return build(memberVipHistory);
21 }
22
23 public static MemberVipHistory build(Long memberId, Integer vip, Integer beforeVip, LocalDateTime vipExpireTime ) {
24 MemberVipHistory memberVipHistory = new MemberVipHistory();
25 memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId);
26 memberVipHistory.setVip(Objects.isNull(vip)? null:vip);
27 memberVipHistory.setBeforeVip(Objects.isNull(beforeVip)? null:beforeVip);
28 memberVipHistory.setVipExpireTime(Objects.isNull(vipExpireTime)? null:vipExpireTime);
29 return build(memberVipHistory);
30 }
31
32 public static MemberVipHistory build(MemberVipHistory memberVipHistory) {
33 return build(memberVipHistory.getId(),
34 memberVipHistory.getMemberId(),
35 memberVipHistory.getVip(),
36 memberVipHistory.getBeforeVip(),
37 memberVipHistory.getVipExpireTime(),
38 memberVipHistory.getStatus());
39 }
40
41 public static MemberVipHistory build(Long id, Long memberId , Integer vip , Integer beforeVip , LocalDateTime vipExpireTime, Integer status){
42 MemberVipHistory memberVipHistory = new MemberVipHistory();
43 memberVipHistory.setId(Objects.isNull(id)? null:id);
44 memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId) ;
45 memberVipHistory.setVip(Objects.isNull(vip)? null:vip);
46 memberVipHistory.setBeforeVip(Objects.isNull(beforeVip)? null:beforeVip);
47 memberVipHistory.setVipExpireTime(Objects.isNull(vipExpireTime)? null:vipExpireTime);
48 memberVipHistory.setStatus(Objects.isNull(status)? 1:status);
49 return memberVipHistory;
50 }
51
52 }
...@@ -2,12 +2,10 @@ package com.topdraw.business.module.member.viphistory.rest; ...@@ -2,12 +2,10 @@ package com.topdraw.business.module.member.viphistory.rest;
2 2
3 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; 3 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
4 import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; 4 import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService;
5 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryQueryCriteria;
6 import com.topdraw.common.ResultInfo; 5 import com.topdraw.common.ResultInfo;
7 import io.swagger.annotations.Api; 6 import io.swagger.annotations.Api;
8 import io.swagger.annotations.ApiOperation; 7 import io.swagger.annotations.ApiOperation;
9 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.data.domain.Pageable;
11 import org.springframework.validation.annotation.Validated; 9 import org.springframework.validation.annotation.Validated;
12 import org.springframework.web.bind.annotation.*; 10 import org.springframework.web.bind.annotation.*;
13 11
...@@ -15,9 +13,9 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,9 +13,9 @@ import org.springframework.web.bind.annotation.*;
15 * @author luerlong 13 * @author luerlong
16 * @date 2021-12-10 14 * @date 2021-12-10
17 */ 15 */
18 @Api(tags = "MemberVipHistory管理") 16 @Api(tags = "会员vip历史管理")
19 @RestController 17 @RestController
20 @RequestMapping("/api/memberVipHistory") 18 @RequestMapping("/ucEngine/api/memberVipHistory")
21 public class MemberVipHistoryController { 19 public class MemberVipHistoryController {
22 20
23 @Autowired 21 @Autowired
...@@ -30,18 +28,4 @@ public class MemberVipHistoryController { ...@@ -30,18 +28,4 @@ public class MemberVipHistoryController {
30 return ResultInfo.success(); 28 return ResultInfo.success();
31 } 29 }
32 30
33 @PutMapping
34 @ApiOperation("修改MemberVipHistory")
35 public ResultInfo update(@Validated @RequestBody MemberVipHistory resources) {
36 memberVipHistoryService.update(resources);
37 return ResultInfo.success();
38 }
39
40 @DeleteMapping(value = "/{id}")
41 @ApiOperation("删除MemberVipHistory")
42 public ResultInfo delete(@PathVariable Long id) {
43 memberVipHistoryService.delete(id);
44 return ResultInfo.success();
45 }
46
47 } 31 }
......
1 package com.topdraw.business.module.member.viphistory.service; 1 package com.topdraw.business.module.member.viphistory.service;
2 2
3 import com.topdraw.business.module.member.domain.Member;
3 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; 4 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
4 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; 5 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
5 6
...@@ -26,6 +27,12 @@ public interface MemberVipHistoryService { ...@@ -26,6 +27,12 @@ public interface MemberVipHistoryService {
26 27
27 /** 28 /**
28 * 29 *
30 * @param member
31 */
32 void create(Member member, Integer beforeVip);
33
34 /**
35 *
29 * @param resources 36 * @param resources
30 */ 37 */
31 void update(MemberVipHistory resources); 38 void update(MemberVipHistory resources);
......
1 package com.topdraw.business.module.member.viphistory.service.impl; 1 package com.topdraw.business.module.member.viphistory.service.impl;
2 2
3 3
4 import com.topdraw.business.module.member.domain.Member;
4 import com.topdraw.business.module.member.service.MemberService; 5 import com.topdraw.business.module.member.service.MemberService;
5 import com.topdraw.business.module.member.service.dto.MemberDTO; 6 import com.topdraw.business.module.member.service.dto.MemberDTO;
6 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; 7 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
8 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistoryBuilder;
7 import com.topdraw.business.module.member.viphistory.repository.MemberVipHistoryRepository; 9 import com.topdraw.business.module.member.viphistory.repository.MemberVipHistoryRepository;
8 import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; 10 import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService;
9 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; 11 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
...@@ -39,10 +41,10 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { ...@@ -39,10 +41,10 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService {
39 @Override 41 @Override
40 public MemberVipHistoryDTO findById(Long id) { 42 public MemberVipHistoryDTO findById(Long id) {
41 log.info("MemberVipHistoryServiceImpl ==>> findById ==>> param ==>> [{}]",id); 43 log.info("MemberVipHistoryServiceImpl ==>> findById ==>> param ==>> [{}]",id);
42 MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(id).orElseGet(MemberVipHistory::new); 44 MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findById(id).orElseGet(MemberVipHistory::new);
43 ValidationUtil.isNull(memberVipHistory.getId(),"MemberVipHistory","id",id); 45 ValidationUtil.isNull(memberVipHistory.getId(),"MemberVipHistory","id",id);
44 log.info("MemberVipHistoryServiceImpl ==>> findById ==>> result ==>> [{}]",memberVipHistory); 46 log.info("MemberVipHistoryServiceImpl ==>> findById ==>> result ==>> [{}]",memberVipHistory);
45 return memberVipHistoryMapper.toDto(memberVipHistory); 47 return this.memberVipHistoryMapper.toDto(memberVipHistory);
46 } 48 }
47 49
48 @Override 50 @Override
...@@ -50,25 +52,34 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { ...@@ -50,25 +52,34 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService {
50 public void create(MemberVipHistory resources) { 52 public void create(MemberVipHistory resources) {
51 log.info("MemberVipHistoryServiceImpl ==>> MemberVipHistoryServiceImpl ==>> param ==>> [{}]",resources); 53 log.info("MemberVipHistoryServiceImpl ==>> MemberVipHistoryServiceImpl ==>> param ==>> [{}]",resources);
52 this.checkMember(resources); 54 this.checkMember(resources);
53 memberVipHistoryRepository.save(resources); 55
56 MemberVipHistory memberVipHistory = MemberVipHistoryBuilder.build(resources);
57 this.memberVipHistoryRepository.save(memberVipHistory);
58 }
59
60 @Override
61 public void create(Member member, Integer beforeVip) {
62 this.checkMember(member);
63 MemberVipHistory memberVipHistory = MemberVipHistoryBuilder.build(member, beforeVip);
64 this.memberVipHistoryRepository.save(memberVipHistory);
54 } 65 }
55 66
56 @Override 67 @Override
57 @Transactional(rollbackFor = Exception.class) 68 @Transactional(rollbackFor = Exception.class)
58 public void update(MemberVipHistory resources) { 69 public void update(MemberVipHistory resources) {
59 MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(resources.getId()).orElseGet(MemberVipHistory::new); 70 MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findById(resources.getId()).orElseGet(MemberVipHistory::new);
60 ValidationUtil.isNull( memberVipHistory.getId(),"MemberVipHistory","id",resources.getId()); 71 ValidationUtil.isNull( memberVipHistory.getId(),"MemberVipHistory","id",resources.getId());
61 memberVipHistory.copy(resources); 72 memberVipHistory.copy(resources);
62 memberVipHistoryRepository.save(memberVipHistory); 73 this.memberVipHistoryRepository.save(memberVipHistory);
63 } 74 }
64 75
65 @Override 76 @Override
66 @Transactional(rollbackFor = Exception.class) 77 @Transactional(rollbackFor = Exception.class)
67 public void delete(Long id) { 78 public void delete(Long id) {
68 Assert.notNull(id, "The given id must not be null!"); 79 Assert.notNull(id, "The given id must not be null!");
69 MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(id).orElseThrow( 80 MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findById(id).orElseThrow(
70 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberVipHistory.class, id), 1)); 81 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberVipHistory.class, id), 1));
71 memberVipHistoryRepository.delete(memberVipHistory); 82 this.memberVipHistoryRepository.delete(memberVipHistory);
72 } 83 }
73 84
74 @Override 85 @Override
...@@ -83,4 +94,10 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { ...@@ -83,4 +94,10 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService {
83 return this.memberService.checkMember(memberId, code); 94 return this.memberService.checkMember(memberId, code);
84 } 95 }
85 96
97 private MemberDTO checkMember(Member resources){
98 Long memberId = resources.getId();
99 String code = resources.getCode();
100 return this.memberService.checkMember(memberId, code);
101 }
102
86 } 103 }
......
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;
3 import com.topdraw.business.module.common.domain.AsyncMqModule; 4 import com.topdraw.business.module.common.domain.AsyncMqModule;
4 import lombok.Data; 5 import lombok.Data;
5 import lombok.experimental.Accessors; 6 import lombok.experimental.Accessors;
...@@ -54,7 +55,7 @@ public class PointsAvailable extends AsyncMqModule implements Serializable { ...@@ -54,7 +55,7 @@ public class PointsAvailable extends AsyncMqModule implements Serializable {
54 private Long points; 55 private Long points;
55 56
56 // 过期时间 57 // 过期时间
57 // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 58 // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "")
58 @Column(name = "expire_time") 59 @Column(name = "expire_time")
59 private LocalDateTime expireTime; 60 private LocalDateTime expireTime;
60 61
......
1 package com.topdraw.business.module.points.available.rest;
2
3 /**
4 * @author XiangHan
5 * @date 2021-10-23
6 */
7 //@Api(tags = "PointsAvailable管理")
8 //@RestController
9 //@RequestMapping("/api/PointsAvailable")
10 public class PointsAvailableController {
11
12 /*@Autowired
13 private PointsAvailableService PointsAvailableService;
14
15 @GetMapping
16 @ApiOperation("查询PointsAvailable")
17 public ResultInfo getPointsAvailables(PointsAvailableQueryCriteria criteria, Pageable pageable) {
18 return ResultInfo.successPage(PointsAvailableService.queryAll(criteria,pageable));
19 }
20
21 @GetMapping(value = "/all")
22 @ApiOperation("查询所有PointsAvailable")
23 public ResultInfo getPointsAvailables(PointsAvailableQueryCriteria criteria) {
24 return ResultInfo.success(PointsAvailableService.queryAll(criteria));
25 }
26
27 @Log
28 @PostMapping
29 @ApiOperation("新增PointsAvailable")
30 public ResultInfo create(@Validated @RequestBody PointsAvailable resources) {
31 PointsAvailableService.create(resources);
32 return ResultInfo.success();
33 }
34
35 @Log
36 @PutMapping
37 @ApiOperation("修改PointsAvailable")
38 public ResultInfo update(@Validated @RequestBody PointsAvailable resources) {
39 PointsAvailableService.update(resources);
40 return ResultInfo.success();
41 }
42
43
44 @Log
45 @DeleteMapping(value = "/{id}")
46 @ApiOperation("删除PointsAvailable")
47 public ResultInfo delete(@PathVariable Long id) {
48 PointsAvailableService.delete(id);
49 return ResultInfo.success();
50 }
51
52 @GetMapping(value = "/getByCode/{code}")
53 @ApiOperation(value = "根据标识查询")
54 public ResultInfo getByCode(@PathVariable String code) {
55 return ResultInfo.success(PointsAvailableService.getByCode(code));
56 }*/
57 }
...@@ -16,21 +16,6 @@ import java.util.List; ...@@ -16,21 +16,6 @@ import java.util.List;
16 public interface PointsAvailableService { 16 public interface PointsAvailableService {
17 17
18 /** 18 /**
19 * 查询数据分页
20 * @param criteria 条件参数
21 * @param pageable 分页参数
22 * @return Map<String,Object>
23 */
24 Map<String,Object> queryAll(PointsAvailableQueryCriteria criteria, Pageable pageable);
25
26 /**
27 * 查询所有数据不分页
28 * @param criteria 条件参数
29 * @return List<PointsAvailableDTO>
30 */
31 List<PointsAvailableDTO> queryAll(PointsAvailableQueryCriteria criteria);
32
33 /**
34 * 根据ID查询 19 * 根据ID查询
35 * @param id ID 20 * @param id ID
36 * @return PointsAvailableDTO 21 * @return PointsAvailableDTO
......
...@@ -44,23 +44,11 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -44,23 +44,11 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
44 private RedissonClient redissonClient; 44 private RedissonClient redissonClient;
45 45
46 @Override 46 @Override
47 public Map<String, Object> queryAll(PointsAvailableQueryCriteria criteria, Pageable pageable) {
48 Page<PointsAvailable> page = PointsAvailableRepository.findAll((root, criteriaQuery, criteriaBuilder) ->
49 QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
50 return PageUtil.toPage(page.map(PointsAvailableMapper::toDto));
51 }
52
53 @Override
54 public List<PointsAvailableDTO> findByMemberIdOrderByExpireTime(Long memberId) { 47 public List<PointsAvailableDTO> findByMemberIdOrderByExpireTime(Long memberId) {
55 return PointsAvailableMapper.toDto(PointsAvailableRepository.findByMemberIdOrderByExpireTime(memberId)); 48 return PointsAvailableMapper.toDto(PointsAvailableRepository.findByMemberIdOrderByExpireTime(memberId));
56 } 49 }
57 50
58 @Override 51 @Override
59 public List<PointsAvailableDTO> queryAll(PointsAvailableQueryCriteria criteria) {
60 return PointsAvailableMapper.toDto(PointsAvailableRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
61 }
62
63 @Override
64 public PointsAvailableDTO findById(Long id) { 52 public PointsAvailableDTO findById(Long id) {
65 PointsAvailable PointsAvailable = PointsAvailableRepository.findById(id).orElseGet(PointsAvailable::new); 53 PointsAvailable PointsAvailable = PointsAvailableRepository.findById(id).orElseGet(PointsAvailable::new);
66 ValidationUtil.isNull(PointsAvailable.getId(),"PointsAvailable","id",id); 54 ValidationUtil.isNull(PointsAvailable.getId(),"PointsAvailable","id",id);
......
1 package com.topdraw.business.module.points.rest;
2
3 import io.swagger.annotations.*;
4
5 /**
6 * @author XiangHan
7 * @date 2021-10-22
8 */
9 @Api(tags = "Points管理")
10 //@RestController
11 //@RequestMapping("/api/Points")
12 public class PointsController {
13
14 /*@Autowired
15 private PointsService PointsService;
16
17 @GetMapping
18 @ApiOperation("查询Points")
19 public ResultInfo getPointss(PointsQueryCriteria criteria, Pageable pageable) {
20 return ResultInfo.successPage(PointsService.queryAll(criteria,pageable));
21 }
22
23 @GetMapping(value = "/all")
24 @ApiOperation("查询所有Points")
25 public ResultInfo getPointss(PointsQueryCriteria criteria) {
26 return ResultInfo.success(PointsService.queryAll(criteria));
27 }*/
28
29 /*@Log
30 @PostMapping
31 @ApiOperation("新增Points")
32 public ResultInfo create(@Validated @RequestBody Points resources) {
33 PointsService.create(resources);
34 return ResultInfo.success();
35 }
36
37 @Log
38 @PutMapping
39 @ApiOperation("修改Points")
40 public ResultInfo update(@Validated @RequestBody Points resources) {
41 PointsService.update(resources);
42 return ResultInfo.success();
43 }
44
45
46 @Log
47 @DeleteMapping(value = "/{id}")
48 @ApiOperation("删除Points")
49 public ResultInfo delete(@PathVariable Long id) {
50 PointsService.delete(id);
51 return ResultInfo.success();
52 }*/
53
54 }
1 package com.topdraw.business.module.rights.history.repository; 1 package com.topdraw.business.module.rights.history.repository;
2 2
3 import com.topdraw.business.module.rights.history.domain.RightsHistory; 3 import com.topdraw.business.module.rights.history.domain.RightsHistory;
4 import com.topdraw.business.module.rights.history.service.dto.RightsHistoryDTO;
4 import org.springframework.data.jpa.repository.JpaRepository; 5 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 6 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 7
8 import java.util.List;
9
7 /** 10 /**
8 * @author XiangHan 11 * @author XiangHan
9 * @date 2021-10-22 12 * @date 2021-10-22
10 */ 13 */
11 public interface RightsHistoryRepository extends JpaRepository<RightsHistory, Long>, JpaSpecificationExecutor<RightsHistory> { 14 public interface RightsHistoryRepository extends JpaRepository<RightsHistory, Long>, JpaSpecificationExecutor<RightsHistory> {
12 15
16 List<RightsHistoryDTO> findByMemberId(Long memberId);
13 } 17 }
......
...@@ -14,6 +14,14 @@ import java.util.List; ...@@ -14,6 +14,14 @@ import java.util.List;
14 public interface RightsHistoryService { 14 public interface RightsHistoryService {
15 15
16 /** 16 /**
17 *
18 * @param memberId
19 * @param memberCode
20 * @return
21 */
22 List<RightsHistoryDTO> findByMemberIdOrMemberCode(Long memberId , String memberCode);
23
24 /**
17 * 根据ID查询 25 * 根据ID查询
18 * @param id ID 26 * @param id ID
19 * @return RightsHistoryDTO 27 * @return RightsHistoryDTO
......
1 package com.topdraw.business.module.rights.history.service.impl; 1 package com.topdraw.business.module.rights.history.service.impl;
2 2
3 import com.topdraw.business.module.member.service.MemberService;
4 import com.topdraw.business.module.member.service.dto.MemberDTO;
3 import com.topdraw.business.module.rights.history.domain.RightsHistory; 5 import com.topdraw.business.module.rights.history.domain.RightsHistory;
4 import com.topdraw.utils.ValidationUtil; 6 import com.topdraw.utils.ValidationUtil;
5 import com.topdraw.business.module.rights.history.repository.RightsHistoryRepository; 7 import com.topdraw.business.module.rights.history.repository.RightsHistoryRepository;
...@@ -14,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -14,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.dao.EmptyResultDataAccessException; 16 import org.springframework.dao.EmptyResultDataAccessException;
15 import org.springframework.util.Assert; 17 import org.springframework.util.Assert;
16 18
19 import java.util.List;
20
17 /** 21 /**
18 * @author XiangHan 22 * @author XiangHan
19 * @date 2021-10-22 23 * @date 2021-10-22
...@@ -23,40 +27,49 @@ import org.springframework.util.Assert; ...@@ -23,40 +27,49 @@ import org.springframework.util.Assert;
23 public class RightsHistoryServiceImpl implements RightsHistoryService { 27 public class RightsHistoryServiceImpl implements RightsHistoryService {
24 28
25 @Autowired 29 @Autowired
26 private RightsHistoryRepository RightsHistoryRepository; 30 private MemberService memberService;
27
28 @Autowired 31 @Autowired
29 private RightsHistoryMapper RightsHistoryMapper; 32 private RightsHistoryMapper rightsHistoryMapper;
33 @Autowired
34 private RightsHistoryRepository rightsHistoryRepository;
35
36
37 @Override
38 public List<RightsHistoryDTO> findByMemberIdOrMemberCode(Long memberId, String memberCode) {
39 MemberDTO memberDTO = this.memberService.checkMember(memberId, memberCode);
40 List<RightsHistoryDTO> rightsHistoryDTOList = this.rightsHistoryRepository.findByMemberId(memberDTO.getId());
41 return rightsHistoryDTOList;
42 }
30 43
31 @Override 44 @Override
32 public RightsHistoryDTO findById(Long id) { 45 public RightsHistoryDTO findById(Long id) {
33 RightsHistory RightsHistory = RightsHistoryRepository.findById(id).orElseGet(RightsHistory::new); 46 RightsHistory RightsHistory = this.rightsHistoryRepository.findById(id).orElseGet(RightsHistory::new);
34 ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",id); 47 ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",id);
35 return RightsHistoryMapper.toDto(RightsHistory); 48 return this.rightsHistoryMapper.toDto(RightsHistory);
36 } 49 }
37 50
38 @Override 51 @Override
39 @Transactional(rollbackFor = Exception.class) 52 @Transactional(rollbackFor = Exception.class)
40 public void create(RightsHistory resources) { 53 public void create(RightsHistory resources) {
41 RightsHistoryRepository.save(resources); 54 this.rightsHistoryRepository.save(resources);
42 } 55 }
43 56
44 @Override 57 @Override
45 @Transactional(rollbackFor = Exception.class) 58 @Transactional(rollbackFor = Exception.class)
46 public void update(RightsHistory resources) { 59 public void update(RightsHistory resources) {
47 RightsHistory RightsHistory = RightsHistoryRepository.findById(resources.getId()).orElseGet(RightsHistory::new); 60 RightsHistory RightsHistory = this.rightsHistoryRepository.findById(resources.getId()).orElseGet(RightsHistory::new);
48 ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",resources.getId()); 61 ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",resources.getId());
49 RightsHistory.copy(resources); 62 RightsHistory.copy(resources);
50 RightsHistoryRepository.save(RightsHistory); 63 this.rightsHistoryRepository.save(RightsHistory);
51 } 64 }
52 65
53 @Override 66 @Override
54 @Transactional(rollbackFor = Exception.class) 67 @Transactional(rollbackFor = Exception.class)
55 public void delete(Long id) { 68 public void delete(Long id) {
56 Assert.notNull(id, "The given id must not be null!"); 69 Assert.notNull(id, "The given id must not be null!");
57 RightsHistory RightsHistory = RightsHistoryRepository.findById(id).orElseThrow( 70 RightsHistory RightsHistory = this.rightsHistoryRepository.findById(id).orElseThrow(
58 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", RightsHistory.class, id), 1)); 71 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", RightsHistory.class, id), 1));
59 RightsHistoryRepository.delete(RightsHistory); 72 this.rightsHistoryRepository.delete(RightsHistory);
60 } 73 }
61 74
62 75
......
...@@ -24,58 +24,58 @@ import java.io.Serializable; ...@@ -24,58 +24,58 @@ import java.io.Serializable;
24 @Table(name="uc_permanent_rights") 24 @Table(name="uc_permanent_rights")
25 public class PermanentRights implements Serializable { 25 public class PermanentRights implements Serializable {
26 26
27 // ID 27 /** ID */
28 @Id 28 @Id
29 @GeneratedValue(strategy = GenerationType.IDENTITY) 29 @GeneratedValue(strategy = GenerationType.IDENTITY)
30 @Column(name = "id") 30 @Column(name = "id")
31 private Long id; 31 private Long id;
32 32
33 // 标识 33 /** 标识 */
34 @Column(name = "code", nullable = false) 34 @Column(name = "code", nullable = false)
35 private String code; 35 private String code;
36 36
37 // 名称 37 /** 名称 */
38 @Column(name = "name", nullable = false) 38 @Column(name = "name", nullable = false)
39 private String name; 39 private String name;
40 40
41 // 永久权益类型 0:vip;1:会员等级 41 /** 永久权益类型 0:vip;1:会员等级 */
42 @Column(name = "type") 42 @Column(name = "type")
43 private Integer type; 43 private Integer type;
44 44
45 // 等级(当权益类型为vip时,对应vip值,当权益类型为会员等级时,对应等级index) 45 /** 等级(当权益类型为vip时,对应vip值,当权益类型为会员等级时,对应等级index) */
46 @Column(name = "level") 46 @Column(name = "level")
47 private Integer level; 47 private Integer level;
48 48
49 // 商品折扣,10代表10% off,范围为0-100 49 /** 商品折扣,10代表10% off,范围为0-100 */
50 @Column(name = "item_discount", nullable = false) 50 @Column(name = "item_discount", nullable = false)
51 private BigDecimal itemDiscount; 51 private BigDecimal itemDiscount;
52 52
53 // 额外积分比率,范围为0-1000 53 /** 额外积分比率,范围为0-1000 */
54 @Column(name = "extra_points", nullable = false) 54 @Column(name = "extra_points", nullable = false)
55 private BigDecimal extraPoints; 55 private BigDecimal extraPoints;
56 56
57 // 免广告 57 /** 免广告 */
58 @Column(name = "ad_disabled", nullable = false) 58 @Column(name = "ad_disabled", nullable = false)
59 private Integer adDisabled; 59 private Integer adDisabled;
60 60
61 // 额外活动参与机会 61 /** 额外活动参与机会 */
62 @Column(name = "extra_activity_ticket", nullable = false) 62 @Column(name = "extra_activity_ticket", nullable = false)
63 private Integer extraActivityTicket; 63 private Integer extraActivityTicket;
64 64
65 // 免费试看 65 /** 免费试看 */
66 @Column(name = "free_trial", nullable = false) 66 @Column(name = "free_trial", nullable = false)
67 private Integer freeTrial; 67 private Integer freeTrial;
68 68
69 // 上电视专区权益 69 /** 上电视专区权益 */
70 @Column(name = "zone_sds", nullable = false) 70 @Column(name = "zone_sds", nullable = false)
71 private Integer zoneSds; 71 private Integer zoneSds;
72 72
73 // 创建时间 73 /** 创建时间 */
74 @CreatedDate 74 @CreatedDate
75 @Column(name = "create_time") 75 @Column(name = "create_time")
76 private Timestamp createTime; 76 private Timestamp createTime;
77 77
78 // 更新时间 78 /** 更新时间 */
79 @LastModifiedDate 79 @LastModifiedDate
80 @Column(name = "update_time") 80 @Column(name = "update_time")
81 private Timestamp updateTime; 81 private Timestamp updateTime;
......
1 package com.topdraw.business.module.rights.permanentrights.rest;
2
3 import com.topdraw.common.ResultInfo;
4 import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
5 import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService;
6 import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.data.domain.Pageable;
9 import org.springframework.validation.annotation.Validated;
10 import org.springframework.web.bind.annotation.*;
11 import io.swagger.annotations.*;
12
13 /**
14 * @author XiangHan
15 * @date 2021-10-22
16 */
17 @Api(tags = "PermanentRights管理")
18 @RestController
19 @RequestMapping("/api/PermanentRights")
20 public class PermanentRightsController {
21
22 @Autowired
23 private PermanentRightsService PermanentRightsService;
24
25 @GetMapping
26 @ApiOperation("查询PermanentRights")
27 public ResultInfo pagePermanentRights(PermanentRightsQueryCriteria criteria, Pageable pageable) {
28 return ResultInfo.successPage(PermanentRightsService.queryAll(criteria,pageable));
29 }
30
31 @GetMapping(value = "/findById/{id}")
32 @ApiOperation("查询PermanentRights")
33 public ResultInfo findById(@PathVariable("id") Long id) {
34 return ResultInfo.success(PermanentRightsService.findById(id));
35 }
36
37 @PostMapping(value = "/create")
38 @ApiOperation("新增PermanentRights")
39 public ResultInfo create(@Validated @RequestBody PermanentRights resources) {
40 PermanentRightsService.create(resources);
41 return ResultInfo.success();
42 }
43
44 @PutMapping(value = "/update")
45 @ApiOperation("修改PermanentRights")
46 public ResultInfo update(@Validated @RequestBody PermanentRights resources) {
47 PermanentRightsService.update(resources);
48 return ResultInfo.success();
49 }
50
51 @DeleteMapping(value = "/delete/{id}")
52 @ApiOperation("删除PermanentRights")
53 public ResultInfo delete(@PathVariable Long id) {
54 PermanentRightsService.delete(id);
55 return ResultInfo.success();
56 }
57
58 @GetMapping(value = "/getByCode/{code}")
59 @ApiOperation(value = "根据标识查询")
60 public ResultInfo getByCode(@PathVariable String code) {
61 return ResultInfo.success(PermanentRightsService.getByCode(code));
62 }
63 }
1 package com.topdraw.business.module.rights.permanentrights.service; 1 package com.topdraw.business.module.rights.permanentrights.service;
2 2
3 import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
4 import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO; 3 import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO;
5 import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria;
6 import org.springframework.data.domain.Pageable;
7 import java.util.Map;
8 import java.util.List;
9 4
10 /** 5 /**
11 * @author XiangHan 6 * @author XiangHan
...@@ -14,33 +9,12 @@ import java.util.List; ...@@ -14,33 +9,12 @@ import java.util.List;
14 public interface PermanentRightsService { 9 public interface PermanentRightsService {
15 10
16 /** 11 /**
17 * 查询数据分页
18 * @param criteria 条件参数
19 * @param pageable 分页参数
20 * @return Map<String,Object>
21 */
22 Map<String,Object> queryAll(PermanentRightsQueryCriteria criteria, Pageable pageable);
23
24 /**
25 * 查询所有数据不分页
26 * @param criteria 条件参数
27 * @return List<PermanentRightsDTO>
28 */
29 List<PermanentRightsDTO> queryAll(PermanentRightsQueryCriteria criteria);
30
31 /**
32 * 根据ID查询 12 * 根据ID查询
33 * @param id ID 13 * @param id ID
34 * @return PermanentRightsDTO 14 * @return PermanentRightsDTO
35 */ 15 */
36 PermanentRightsDTO findById(Long id); 16 PermanentRightsDTO findById(Long id);
37 17
38 void create(PermanentRights resources);
39
40 void update(PermanentRights resources);
41
42 void delete(Long id);
43
44 /** 18 /**
45 * Code校验 19 * Code校验
46 * @param code 20 * @param code
......
...@@ -13,42 +13,42 @@ import java.io.Serializable; ...@@ -13,42 +13,42 @@ import java.io.Serializable;
13 @Data 13 @Data
14 public class PermanentRightsDTO implements Serializable { 14 public class PermanentRightsDTO implements Serializable {
15 15
16 // ID 16 /** ID */
17 private Long id; 17 private Long id;
18 18
19 // 标识 19 /** 标识 */
20 private String code; 20 private String code;
21 21
22 // 名称 22 /** 名称 */
23 private String name; 23 private String name;
24 24
25 // 永久权益类型 0:vip;1:会员等级 25 /** 永久权益类型 0:vip;1:会员等级 */
26 private Integer type; 26 private Integer type;
27 27
28 // 等级(当权益类型为vip时,对应vip值,当权益类型为会员等级时,对应等级index) 28 /** 等级(当权益类型为vip时,对应vip值,当权益类型为会员等级时,对应等级index) */
29 private Integer level; 29 private Integer level;
30 30
31 // 商品折扣,10代表10% off,范围为0-100 31 /** 商品折扣,10代表10% off,范围为0-100 */
32 private BigDecimal itemDiscount; 32 private BigDecimal itemDiscount;
33 33
34 // 额外积分比率,范围为0-1000 34 /** 额外积分比率,范围为0-1000 */
35 private BigDecimal extraPoints; 35 private BigDecimal extraPoints;
36 36
37 // 免广告 37 /** 免广告 */
38 private Integer adDisabled; 38 private Integer adDisabled;
39 39
40 // 额外活动参与机会 40 /** 额外活动参与机会 */
41 private Integer extraActivityTicket; 41 private Integer extraActivityTicket;
42 42
43 // 免费试看 43 /** 免费试看 */
44 private Integer freeTrial; 44 private Integer freeTrial;
45 45
46 // 上电视专区权益 46 /** 上电视专区权益 */
47 private Integer zoneSds; 47 private Integer zoneSds;
48 48
49 // 创建时间 49 /** 创建时间 */
50 private Timestamp createTime; 50 private Timestamp createTime;
51 51
52 // 更新时间 52 /** 更新时间 */
53 private Timestamp updateTime; 53 private Timestamp updateTime;
54 } 54 }
......
1 package com.topdraw.business.module.rights.permanentrights.service.dto;
2
3 import com.topdraw.annotation.Query;
4 import lombok.Data;
5
6 /**
7 * @author XiangHan
8 * @date 2021-10-22
9 */
10 @Data
11 public class PermanentRightsQueryCriteria{
12
13 @Query(type = Query.Type.EQUAL)
14 private Integer level;
15
16 }
...@@ -5,23 +5,13 @@ import com.topdraw.utils.ValidationUtil; ...@@ -5,23 +5,13 @@ import com.topdraw.utils.ValidationUtil;
5 import com.topdraw.business.module.rights.permanentrights.repository.PermanentRightsRepository; 5 import com.topdraw.business.module.rights.permanentrights.repository.PermanentRightsRepository;
6 import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService; 6 import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService;
7 import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO; 7 import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO;
8 import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria;
9 import com.topdraw.business.module.rights.permanentrights.service.mapper.PermanentRightsMapper; 8 import com.topdraw.business.module.rights.permanentrights.service.mapper.PermanentRightsMapper;
10 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation; 11 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional; 12 import org.springframework.transaction.annotation.Transactional;
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;
18 import com.topdraw.utils.PageUtil;
19 import com.topdraw.utils.QueryHelp;
20 import com.topdraw.utils.StringUtils; 13 import com.topdraw.utils.StringUtils;
21 14
22 import java.util.List;
23 import java.util.Map;
24
25 /** 15 /**
26 * @author XiangHan 16 * @author XiangHan
27 * @date 2021-10-22 17 * @date 2021-10-22
...@@ -31,63 +21,27 @@ import java.util.Map; ...@@ -31,63 +21,27 @@ import java.util.Map;
31 public class PermanentRightsServiceImpl implements PermanentRightsService { 21 public class PermanentRightsServiceImpl implements PermanentRightsService {
32 22
33 @Autowired 23 @Autowired
34 private PermanentRightsRepository PermanentRightsRepository; 24 private PermanentRightsRepository permanentRightsRepository;
35 25
36 @Autowired 26 @Autowired
37 private PermanentRightsMapper PermanentRightsMapper; 27 private PermanentRightsMapper permanentRightsMapper;
38
39 @Override
40 public Map<String, Object> queryAll(PermanentRightsQueryCriteria criteria, Pageable pageable) {
41 Page<PermanentRights> page = PermanentRightsRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
42 return PageUtil.toPage(page.map(PermanentRightsMapper::toDto));
43 }
44
45 @Override
46 public List<PermanentRightsDTO> queryAll(PermanentRightsQueryCriteria criteria) {
47 return PermanentRightsMapper.toDto(PermanentRightsRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
48 }
49 28
50 @Override 29 @Override
51 public PermanentRightsDTO findById(Long id) { 30 public PermanentRightsDTO findById(Long id) {
52 PermanentRights PermanentRights = PermanentRightsRepository.findById(id).orElseGet(PermanentRights::new); 31 PermanentRights PermanentRights = this.permanentRightsRepository.findById(id).orElseGet(PermanentRights::new);
53 ValidationUtil.isNull(PermanentRights.getId(),"PermanentRights","id",id); 32 ValidationUtil.isNull(PermanentRights.getId(),"PermanentRights","id",id);
54 return PermanentRightsMapper.toDto(PermanentRights); 33 return this.permanentRightsMapper.toDto(PermanentRights);
55 } 34 }
56 35
57 @Override 36 @Override
58 @Transactional(rollbackFor = Exception.class)
59 public void create(PermanentRights resources) {
60 PermanentRightsRepository.save(resources);
61 }
62
63 @Override
64 @Transactional(rollbackFor = Exception.class)
65 public void update(PermanentRights resources) {
66 PermanentRights PermanentRights = PermanentRightsRepository.findById(resources.getId()).orElseGet(PermanentRights::new);
67 ValidationUtil.isNull( PermanentRights.getId(),"PermanentRights","id",resources.getId());
68 PermanentRights.copy(resources);
69 PermanentRightsRepository.save(PermanentRights);
70 }
71
72 @Override
73 @Transactional(rollbackFor = Exception.class)
74 public void delete(Long id) {
75 Assert.notNull(id, "The given id must not be null!");
76 PermanentRights PermanentRights = PermanentRightsRepository.findById(id).orElseThrow(
77 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PermanentRights.class, id), 1));
78 PermanentRightsRepository.delete(PermanentRights);
79 }
80
81
82 @Override
83 public PermanentRightsDTO getByCode(String code) { 37 public PermanentRightsDTO getByCode(String code) {
84 return StringUtils.isNotEmpty(code) ? PermanentRightsMapper.toDto(PermanentRightsRepository.findFirstByCode(code).orElseGet(PermanentRights::new)) 38 return StringUtils.isNotEmpty(code) ? this.permanentRightsMapper.toDto(this.permanentRightsRepository.findFirstByCode(code).orElseGet(PermanentRights::new))
85 : new PermanentRightsDTO(); 39 : new PermanentRightsDTO();
86 } 40 }
87 41
88 @Override 42 @Override
89 public PermanentRightsDTO findByLevel(Integer level) { 43 public PermanentRightsDTO findByLevel(Integer level) {
90 PermanentRights PermanentRights = PermanentRightsRepository.findByLevel(level); 44 PermanentRights PermanentRights = this.permanentRightsRepository.findByLevel(level);
91 return PermanentRightsMapper.toDto(PermanentRights); 45 return this.permanentRightsMapper.toDto(PermanentRights);
92 } 46 }
93 } 47 }
......
1 package com.topdraw.business.module.rights.rest;
2
3 import com.topdraw.business.module.rights.service.RightsService;
4 import com.topdraw.common.ResultInfo;
5 import io.swagger.annotations.Api;
6 import io.swagger.annotations.ApiOperation;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.web.bind.annotation.GetMapping;
9 import org.springframework.web.bind.annotation.PathVariable;
10 import org.springframework.web.bind.annotation.RequestMapping;
11 import org.springframework.web.bind.annotation.RestController;
12
13 /**
14 * @author XiangHan
15 * @date 2021-10-22
16 */
17 @Api(tags = "Rights管理")
18 @RestController
19 @RequestMapping("/api/Rights")
20 public class RightsController {
21
22 @Autowired
23 private RightsService rightsService;
24
25 @GetMapping(value = "/findById/{id}")
26 @ApiOperation("查询Rights")
27 public ResultInfo findById(@PathVariable("id") Long id) {
28 return ResultInfo.success(rightsService.findById(id));
29 }
30
31 }
...@@ -5,8 +5,6 @@ import lombok.experimental.Accessors; ...@@ -5,8 +5,6 @@ import lombok.experimental.Accessors;
5 import cn.hutool.core.bean.BeanUtil; 5 import cn.hutool.core.bean.BeanUtil;
6 import cn.hutool.core.bean.copier.CopyOptions; 6 import cn.hutool.core.bean.copier.CopyOptions;
7 import javax.persistence.*; 7 import javax.persistence.*;
8 import org.springframework.data.annotation.CreatedDate;
9 import org.springframework.data.annotation.LastModifiedDate;
10 import org.springframework.data.jpa.domain.support.AuditingEntityListener; 8 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
11 9
12 import java.io.Serializable; 10 import java.io.Serializable;
...@@ -27,11 +25,11 @@ public class TaskAttr implements Serializable { ...@@ -27,11 +25,11 @@ public class TaskAttr implements Serializable {
27 @Column(name = "id") 25 @Column(name = "id")
28 private Long id; 26 private Long id;
29 27
30 // 任务id(关联task主键) 28 /** 任务id(关联task主键) */
31 @Column(name = "task_id") 29 @Column(name = "task_id")
32 private Long taskId; 30 private Long taskId;
33 31
34 // 任务属性字符串 32 /** 任务属性字符串 */
35 @Column(name = "attr_str") 33 @Column(name = "attr_str")
36 private String attrStr; 34 private String attrStr;
37 35
......
...@@ -15,11 +15,28 @@ public interface TaskAttrService { ...@@ -15,11 +15,28 @@ public interface TaskAttrService {
15 */ 15 */
16 TaskAttrDTO findById(Long id); 16 TaskAttrDTO findById(Long id);
17 17
18 /**
19 *
20 * @param resources
21 */
18 void create(TaskAttr resources); 22 void create(TaskAttr resources);
19 23
24 /**
25 *
26 * @param resources
27 */
20 void update(TaskAttr resources); 28 void update(TaskAttr resources);
21 29
30 /**
31 *
32 * @param id
33 */
22 void delete(Long id); 34 void delete(Long id);
23 35
36 /**
37 *
38 * @param taskId
39 * @return
40 */
24 TaskAttrDTO findByTaskId(Long taskId); 41 TaskAttrDTO findByTaskId(Long taskId);
25 } 42 }
......
...@@ -3,7 +3,6 @@ package com.topdraw.business.module.task.attribute.service.dto; ...@@ -3,7 +3,6 @@ package com.topdraw.business.module.task.attribute.service.dto;
3 import lombok.Data; 3 import lombok.Data;
4 import java.io.Serializable; 4 import java.io.Serializable;
5 5
6
7 /** 6 /**
8 * @author XiangHan 7 * @author XiangHan
9 * @date 2022-01-13 8 * @date 2022-01-13
...@@ -13,9 +12,9 @@ public class TaskAttrDTO implements Serializable { ...@@ -13,9 +12,9 @@ public class TaskAttrDTO implements Serializable {
13 12
14 private Long id; 13 private Long id;
15 14
16 // 任务id(关联task主键) 15 /** 任务id(关联task主键) */
17 private Long taskId; 16 private Long taskId;
18 17
19 // 任务属性字符串 18 /** 任务属性字符串 */
20 private String attrStr; 19 private String attrStr;
21 } 20 }
......
1 package com.topdraw.business.module.task.attribute.service.dto;
2
3 import lombok.Data;
4 import com.topdraw.annotation.Query;
5
6 /**
7 * @author XiangHan
8 * @date 2022-01-13
9 */
10 @Data
11 public class TaskAttrQueryCriteria{
12 }
...@@ -22,46 +22,46 @@ import org.springframework.util.Assert; ...@@ -22,46 +22,46 @@ import org.springframework.util.Assert;
22 public class TaskAttrServiceImpl implements TaskAttrService { 22 public class TaskAttrServiceImpl implements TaskAttrService {
23 23
24 @Autowired 24 @Autowired
25 private TaskAttrRepository TaskAttrRepository; 25 private TaskAttrMapper taskAttrMapper;
26
27 @Autowired 26 @Autowired
28 private TaskAttrMapper TaskAttrMapper; 27 private TaskAttrRepository taskAttrRepository;
28
29 29
30 @Override 30 @Override
31 public TaskAttrDTO findById(Long id) { 31 public TaskAttrDTO findById(Long id) {
32 TaskAttr TaskAttr = TaskAttrRepository.findById(id).orElseGet(TaskAttr::new); 32 TaskAttr TaskAttr = this.taskAttrRepository.findById(id).orElseGet(TaskAttr::new);
33 ValidationUtil.isNull(TaskAttr.getId(),"TaskAttr","id",id); 33 ValidationUtil.isNull(TaskAttr.getId(),"TaskAttr","id",id);
34 return TaskAttrMapper.toDto(TaskAttr); 34 return this.taskAttrMapper.toDto(TaskAttr);
35 } 35 }
36 36
37 @Override 37 @Override
38 @Transactional(rollbackFor = Exception.class) 38 @Transactional(rollbackFor = Exception.class)
39 public void create(TaskAttr resources) { 39 public void create(TaskAttr resources) {
40 TaskAttrRepository.save(resources); 40 this.taskAttrRepository.save(resources);
41 } 41 }
42 42
43 @Override 43 @Override
44 @Transactional(rollbackFor = Exception.class) 44 @Transactional(rollbackFor = Exception.class)
45 public void update(TaskAttr resources) { 45 public void update(TaskAttr resources) {
46 TaskAttr TaskAttr = TaskAttrRepository.findById(resources.getId()).orElseGet(TaskAttr::new); 46 TaskAttr TaskAttr = this.taskAttrRepository.findById(resources.getId()).orElseGet(TaskAttr::new);
47 ValidationUtil.isNull( TaskAttr.getId(),"TaskAttr","id",resources.getId()); 47 ValidationUtil.isNull( TaskAttr.getId(),"TaskAttr","id",resources.getId());
48 TaskAttr.copy(resources); 48 TaskAttr.copy(resources);
49 TaskAttrRepository.save(TaskAttr); 49 this.taskAttrRepository.save(TaskAttr);
50 } 50 }
51 51
52 @Override 52 @Override
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 = 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 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 = TaskAttrRepository.findByTaskId(taskId).orElseGet(TaskAttr::new); 63 TaskAttr TaskAttr = this.taskAttrRepository.findByTaskId(taskId).orElseGet(TaskAttr::new);
64 return TaskAttrMapper.toDto(TaskAttr); 64 return this.taskAttrMapper.toDto(TaskAttr);
65 } 65 }
66 66
67 67
......
...@@ -29,104 +29,104 @@ public class Task implements Serializable { ...@@ -29,104 +29,104 @@ public class Task implements Serializable {
29 @Column(name = "id") 29 @Column(name = "id")
30 private Long id; 30 private Long id;
31 31
32 // 任务模板id 32 /** 任务模板id */
33 @Column(name = "task_template_id", nullable = false) 33 @Column(name = "task_template_id", nullable = false)
34 private Long taskTemplateId; 34 private Long taskTemplateId;
35 35
36 // 任务重复类型,-1:不限次;1:单次;>1:多次 36 /** 任务重复类型,-1:不限次;1:单次;>1:多次 */
37 @Column(name = "task_repeat_type", nullable = false) 37 @Column(name = "task_repeat_type", nullable = false)
38 private Integer taskRepeatType; 38 private Integer taskRepeatType;
39 39
40 // 任务每日重置 0:不重置;1:重置 40 /** 任务每日重置 0:不重置;1:重置 */
41 @Column(name = "task_daily_reset", nullable = false) 41 @Column(name = "task_daily_reset", nullable = false)
42 private Integer taskDailyReset; 42 private Integer taskDailyReset;
43 43
44 // 行为量(完成此任务需要多少次相同行为的触发) 44 /** 行为量(完成此任务需要多少次相同行为的触发) */
45 @Column(name = "action_amount", nullable = false) 45 @Column(name = "action_amount", nullable = false)
46 private Integer actionAmount; 46 private Integer actionAmount;
47 47
48 // 任务生效时间 48 /** 任务生效时间 */
49 @Column(name = "valid_time") 49 @Column(name = "valid_time")
50 private Timestamp validTime; 50 private Timestamp validTime;
51 51
52 // 任务失效时间 52 /** 任务失效时间 */
53 @Column(name = "expire_time") 53 @Column(name = "expire_time")
54 private LocalDateTime expireTime; 54 private LocalDateTime expireTime;
55 55
56 // 显示顺序 56 /** 显示顺序 */
57 @Column(name = "sequence") 57 @Column(name = "sequence")
58 private Integer sequence; 58 private Integer sequence;
59 59
60 // 获得成长值 60 /** 获得成长值 */
61 @Column(name = "reward_exp", nullable = false) 61 @Column(name = "reward_exp", nullable = false)
62 private Long rewardExp; 62 private Long rewardExp;
63 63
64 // 获得积分 64 /** 获得积分 */
65 @Column(name = "reward_points", nullable = false) 65 @Column(name = "reward_points", nullable = false)
66 private Long rewardPoints; 66 private Long rewardPoints;
67 67
68 // 积分过期时间(空为不过期) 68 /** 积分过期时间(空为不过期) */
69 @Column(name = "reward_points_expire_time") 69 @Column(name = "reward_points_expire_time")
70 private Long rewardPointsExpireTime; 70 private Long rewardPointsExpireTime;
71 71
72 // 积分获取类型 0:定值;1:随机 72 /** 积分获取类型 0:定值;1:随机 */
73 @Column(name = "points_type") 73 @Column(name = "points_type")
74 private Integer pointsType; 74 private Integer pointsType;
75 75
76 // 随机积分最大值 76 /** 随机积分最大值 */
77 @Column(name = "reward_max_points") 77 @Column(name = "reward_max_points")
78 private Integer rewardMaxPoints; 78 private Integer rewardMaxPoints;
79 79
80 // 能够获取该任务的用户分组,为空则都能获取 80 /** 能够获取该任务的用户分组,为空则都能获取 */
81 @Column(name = "groups") 81 @Column(name = "groups")
82 private String groups; 82 private String groups;
83 83
84 // 权益发放策略 0:立即发放;1:次日发放;2:次月发放 84 /** 权益发放策略 0:立即发放;1:次日发放;2:次月发放 */
85 @Column(name = "rights_send_strategy", nullable = false) 85 @Column(name = "rights_send_strategy", nullable = false)
86 private Integer rightsSendStrategy; 86 private Integer rightsSendStrategy;
87 87
88 // 会员等级门槛(0表示无门槛) 88 /** 会员等级门槛(0表示无门槛) */
89 @Column(name = "member_level", nullable = false) 89 @Column(name = "member_level", nullable = false)
90 private Integer memberLevel; 90 private Integer memberLevel;
91 91
92 // 会员vip门槛(0表示没有门槛) 92 /** 会员vip门槛(0表示没有门槛) */
93 @Column(name = "member_vip") 93 @Column(name = "member_vip")
94 private Integer memberVip; 94 private Integer memberVip;
95 95
96 // 权益id 96 /** 权益id */
97 @Column(name = "rights_id") 97 @Column(name = "rights_id")
98 private Long rightsId; 98 private Long rightsId;
99 99
100 // 权益数量(活动机会次数、优惠券数量、奖品数量) 100 /** 权益数量(活动机会次数、优惠券数量、奖品数量) */
101 @Column(name = "rights_amount") 101 @Column(name = "rights_amount")
102 private Integer rightsAmount; 102 private Integer rightsAmount;
103 103
104 // 权益2id 104 /** 权益2id */
105 @Column(name = "rights2_id") 105 @Column(name = "rights2_id")
106 private Long rights2Id; 106 private Long rights2Id;
107 107
108 // 权益2数量 108 /** 权益2数量 */
109 @Column(name = "rights2_amount") 109 @Column(name = "rights2_amount")
110 private Integer rights2Amount; 110 private Integer rights2Amount;
111 111
112 // 权益3id 112 /** 权益3id */
113 @Column(name = "rights3_id") 113 @Column(name = "rights3_id")
114 private Long rights3Id; 114 private Long rights3Id;
115 115
116 // 权益3数量 116 /** 权益3数量 */
117 @Column(name = "rights3_amount") 117 @Column(name = "rights3_amount")
118 private Integer rights3Amount; 118 private Integer rights3Amount;
119 119
120 // 状态 0:失效;1:生效 120 /** 状态 0:失效;1:生效 */
121 @Column(name = "status", nullable = false) 121 @Column(name = "status", nullable = false)
122 private Integer status; 122 private Integer status;
123 123
124 // 创建时间 124 /** 创建时间 */
125 @CreatedDate 125 @CreatedDate
126 @Column(name = "create_time") 126 @Column(name = "create_time")
127 private Timestamp createTime; 127 private Timestamp createTime;
128 128
129 // 更新时间 129 /** 更新时间 */
130 @LastModifiedDate 130 @LastModifiedDate
131 @Column(name = "update_time") 131 @Column(name = "update_time")
132 private Timestamp updateTime; 132 private Timestamp updateTime;
......
...@@ -32,27 +32,27 @@ public class TrTaskProgress implements Serializable { ...@@ -32,27 +32,27 @@ public class TrTaskProgress implements Serializable {
32 @Column(name = "id") 32 @Column(name = "id")
33 private Long id; 33 private Long id;
34 34
35 // 用户id 35 /** 用户id */
36 @Column(name = "member_id", nullable = false) 36 @Column(name = "member_id", nullable = false)
37 private Long memberId; 37 private Long memberId;
38 38
39 // 任务id 39 /** 任务id */
40 @Column(name = "task_id") 40 @Column(name = "task_id")
41 private Long taskId; 41 private Long taskId;
42 42
43 // 已完成的行为量 43 /** 已完成的行为量 */
44 @Column(name = "current_action_amount") 44 @Column(name = "current_action_amount")
45 private Integer currentActionAmount; 45 private Integer currentActionAmount;
46 46
47 // 目标行为量 47 /** 目标行为量 */
48 @Column(name = "target_action_amount") 48 @Column(name = "target_action_amount")
49 private Integer targetActionAmount; 49 private Integer targetActionAmount;
50 50
51 // 状态 0:未完成;1:已完成 51 /** 状态 0:未完成;1:已完成 */
52 @Column(name = "status") 52 @Column(name = "status")
53 private Integer status; 53 private Integer status;
54 54
55 // 完成时间 55 /** 完成时间 */
56 @Column(name = "completion_time") 56 @Column(name = "completion_time")
57 private Timestamp completionTime; 57 private Timestamp completionTime;
58 58
......
...@@ -3,9 +3,7 @@ package com.topdraw.business.module.task.progress.rest; ...@@ -3,9 +3,7 @@ package com.topdraw.business.module.task.progress.rest;
3 import com.topdraw.common.ResultInfo; 3 import com.topdraw.common.ResultInfo;
4 import com.topdraw.business.module.task.progress.domain.TrTaskProgress; 4 import com.topdraw.business.module.task.progress.domain.TrTaskProgress;
5 import com.topdraw.business.module.task.progress.service.TrTaskProgressService; 5 import com.topdraw.business.module.task.progress.service.TrTaskProgressService;
6 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressQueryCriteria;
7 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.data.domain.Pageable;
9 import org.springframework.validation.annotation.Validated; 7 import org.springframework.validation.annotation.Validated;
10 import org.springframework.web.bind.annotation.*; 8 import org.springframework.web.bind.annotation.*;
11 import io.swagger.annotations.*; 9 import io.swagger.annotations.*;
...@@ -20,38 +18,26 @@ import io.swagger.annotations.*; ...@@ -20,38 +18,26 @@ import io.swagger.annotations.*;
20 public class TrTaskProgressController { 18 public class TrTaskProgressController {
21 19
22 @Autowired 20 @Autowired
23 private TrTaskProgressService TrTaskProgressService; 21 private TrTaskProgressService trTaskProgressService;
24
25 @GetMapping
26 @ApiOperation("查询TrTaskProgress")
27 public ResultInfo getTrTaskProgresss(TrTaskProgressQueryCriteria criteria, Pageable pageable) {
28 return ResultInfo.successPage(TrTaskProgressService.queryAll(criteria,pageable));
29 }
30
31 @GetMapping(value = "/all")
32 @ApiOperation("查询所有TrTaskProgress")
33 public ResultInfo getTrTaskProgresss(TrTaskProgressQueryCriteria criteria) {
34 return ResultInfo.success(TrTaskProgressService.queryAll(criteria));
35 }
36 22
37 @PostMapping 23 @PostMapping
38 @ApiOperation("新增TrTaskProgress") 24 @ApiOperation("新增TrTaskProgress")
39 public ResultInfo create(@Validated @RequestBody TrTaskProgress resources) { 25 public ResultInfo create(@Validated @RequestBody TrTaskProgress resources) {
40 TrTaskProgressService.create(resources); 26 this.trTaskProgressService.create(resources);
41 return ResultInfo.success(); 27 return ResultInfo.success();
42 } 28 }
43 29
44 @PutMapping 30 @PutMapping
45 @ApiOperation("修改TrTaskProgress") 31 @ApiOperation("修改TrTaskProgress")
46 public ResultInfo update(@Validated @RequestBody TrTaskProgress resources) { 32 public ResultInfo update(@Validated @RequestBody TrTaskProgress resources) {
47 TrTaskProgressService.update(resources); 33 this.trTaskProgressService.update(resources);
48 return ResultInfo.success(); 34 return ResultInfo.success();
49 } 35 }
50 36
51 @DeleteMapping(value = "/{id}") 37 @DeleteMapping(value = "/{id}")
52 @ApiOperation("删除TrTaskProgress") 38 @ApiOperation("删除TrTaskProgress")
53 public ResultInfo delete(@PathVariable Long id) { 39 public ResultInfo delete(@PathVariable Long id) {
54 TrTaskProgressService.delete(id); 40 this.trTaskProgressService.delete(id);
55 return ResultInfo.success(); 41 return ResultInfo.success();
56 } 42 }
57 43
......
...@@ -2,9 +2,6 @@ package com.topdraw.business.module.task.progress.service; ...@@ -2,9 +2,6 @@ package com.topdraw.business.module.task.progress.service;
2 2
3 import com.topdraw.business.module.task.progress.domain.TrTaskProgress; 3 import com.topdraw.business.module.task.progress.domain.TrTaskProgress;
4 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; 4 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO;
5 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressQueryCriteria;
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,32 +11,36 @@ import java.util.List; ...@@ -14,32 +11,36 @@ import java.util.List;
14 public interface TrTaskProgressService { 11 public interface TrTaskProgressService {
15 12
16 /** 13 /**
17 * 查询数据分页
18 * @param criteria 条件参数
19 * @param pageable 分页参数
20 * @return Map<String,Object>
21 */
22 Map<String,Object> queryAll(TrTaskProgressQueryCriteria criteria, Pageable pageable);
23
24 /**
25 * 查询所有数据不分页
26 * @param criteria 条件参数
27 * @return List<TrTaskProgressDTO>
28 */
29 List<TrTaskProgressDTO> queryAll(TrTaskProgressQueryCriteria criteria);
30
31 /**
32 * 根据ID查询 14 * 根据ID查询
33 * @param id ID 15 * @param id ID
34 * @return TrTaskProgressDTO 16 * @return TrTaskProgressDTO
35 */ 17 */
36 TrTaskProgressDTO findById(Long id); 18 TrTaskProgressDTO findById(Long id);
37 19
20 /**
21 *
22 * @param resources
23 */
38 void create(TrTaskProgress resources); 24 void create(TrTaskProgress resources);
39 25
26 /**
27 *
28 * @param resources
29 */
40 void update(TrTaskProgress resources); 30 void update(TrTaskProgress resources);
41 31
32 /**
33 *
34 * @param id
35 */
42 void delete(Long id); 36 void delete(Long id);
43 37
38 /**
39 *
40 * @param memberId
41 * @param taskId
42 * @param time1
43 * @return
44 */
44 List<TrTaskProgressDTO> findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1); 45 List<TrTaskProgressDTO> findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1);
45 } 46 }
......
...@@ -14,22 +14,22 @@ public class TrTaskProgressDTO implements Serializable { ...@@ -14,22 +14,22 @@ public class TrTaskProgressDTO implements Serializable {
14 14
15 private Long id; 15 private Long id;
16 16
17 // 用户id 17 /** 用户id */
18 private Long memberId; 18 private Long memberId;
19 19
20 // 任务id 20 /** 任务id */
21 private Long taskId; 21 private Long taskId;
22 22
23 // 已完成的行为量 23 /** 已完成的行为量 */
24 private Integer currentActionAmount; 24 private Integer currentActionAmount;
25 25
26 // 目标行为量 26 /** 目标行为量 */
27 private Integer targetActionAmount; 27 private Integer targetActionAmount;
28 28
29 // 状态 0:未完成;1:已完成 29 /** 状态 0:未完成;1:已完成 */
30 private Integer status; 30 private Integer status;
31 31
32 // 完成时间 32 /** 完成时间 */
33 private Timestamp completionTime; 33 private Timestamp completionTime;
34 34
35 private Timestamp createTime; 35 private Timestamp createTime;
......
1 package com.topdraw.business.module.task.progress.service.dto;
2
3 import lombok.Data;
4 import com.topdraw.annotation.Query;
5
6 /**
7 * @author XiangHan
8 * @date 2021-11-02
9 */
10 @Data
11 public class TrTaskProgressQueryCriteria{
12
13 @Query(type = Query.Type.EQUAL)
14 private Long taskId;
15
16 @Query(type = Query.Type.EQUAL)
17 private Long memberId;
18
19 @Query(type = Query.Type.BETWEEN)
20 private String completionTime;
21
22 }
...@@ -5,21 +5,15 @@ import com.topdraw.utils.ValidationUtil; ...@@ -5,21 +5,15 @@ import com.topdraw.utils.ValidationUtil;
5 import com.topdraw.business.module.task.progress.repository.TrTaskProgressRepository; 5 import com.topdraw.business.module.task.progress.repository.TrTaskProgressRepository;
6 import com.topdraw.business.module.task.progress.service.TrTaskProgressService; 6 import com.topdraw.business.module.task.progress.service.TrTaskProgressService;
7 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; 7 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO;
8 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressQueryCriteria;
9 import com.topdraw.business.module.task.progress.service.mapper.TrTaskProgressMapper; 8 import com.topdraw.business.module.task.progress.service.mapper.TrTaskProgressMapper;
10 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation; 11 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional; 12 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.dao.EmptyResultDataAccessException; 13 import org.springframework.dao.EmptyResultDataAccessException;
15 import org.springframework.data.domain.Page;
16 import org.springframework.data.domain.Pageable;
17 import org.springframework.util.Assert; 14 import org.springframework.util.Assert;
18 import com.topdraw.utils.PageUtil;
19 import com.topdraw.utils.QueryHelp;
20 15
21 import java.util.List; 16 import java.util.List;
22 import java.util.Map;
23 17
24 /** 18 /**
25 * @author XiangHan 19 * @author XiangHan
...@@ -30,56 +24,45 @@ import java.util.Map; ...@@ -30,56 +24,45 @@ import java.util.Map;
30 public class TrTaskProgressServiceImpl implements TrTaskProgressService { 24 public class TrTaskProgressServiceImpl implements TrTaskProgressService {
31 25
32 @Autowired 26 @Autowired
33 private TrTaskProgressRepository TrTaskProgressRepository; 27 private TrTaskProgressRepository trTaskProgressRepository;
34 28
35 @Autowired 29 @Autowired
36 private TrTaskProgressMapper TrTaskProgressMapper; 30 private TrTaskProgressMapper trTaskProgressMapper;
37
38 @Override
39 public Map<String, Object> queryAll(TrTaskProgressQueryCriteria criteria, Pageable pageable) {
40 Page<TrTaskProgress> page = TrTaskProgressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
41 return PageUtil.toPage(page.map(TrTaskProgressMapper::toDto));
42 }
43
44 @Override
45 public List<TrTaskProgressDTO> queryAll(TrTaskProgressQueryCriteria criteria) {
46 return TrTaskProgressMapper.toDto(TrTaskProgressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
47 }
48 31
49 @Override 32 @Override
50 public TrTaskProgressDTO findById(Long id) { 33 public TrTaskProgressDTO findById(Long id) {
51 TrTaskProgress TrTaskProgress = TrTaskProgressRepository.findById(id).orElseGet(TrTaskProgress::new); 34 TrTaskProgress TrTaskProgress = this.trTaskProgressRepository.findById(id).orElseGet(TrTaskProgress::new);
52 ValidationUtil.isNull(TrTaskProgress.getId(),"TrTaskProgress","id",id); 35 ValidationUtil.isNull(TrTaskProgress.getId(),"TrTaskProgress","id",id);
53 return TrTaskProgressMapper.toDto(TrTaskProgress); 36 return this.trTaskProgressMapper.toDto(TrTaskProgress);
54 } 37 }
55 38
56 @Override 39 @Override
57 @Transactional(rollbackFor = Exception.class) 40 @Transactional(rollbackFor = Exception.class)
58 public void create(TrTaskProgress resources) { 41 public void create(TrTaskProgress resources) {
59 TrTaskProgressRepository.save(resources); 42 this.trTaskProgressRepository.save(resources);
60 } 43 }
61 44
62 @Override 45 @Override
63 @Transactional(rollbackFor = Exception.class) 46 @Transactional(rollbackFor = Exception.class)
64 public void update(TrTaskProgress resources) { 47 public void update(TrTaskProgress resources) {
65 TrTaskProgress TrTaskProgress = TrTaskProgressRepository.findById(resources.getId()).orElseGet(TrTaskProgress::new); 48 TrTaskProgress TrTaskProgress = this.trTaskProgressRepository.findById(resources.getId()).orElseGet(TrTaskProgress::new);
66 ValidationUtil.isNull( TrTaskProgress.getId(),"TrTaskProgress","id",resources.getId()); 49 ValidationUtil.isNull( TrTaskProgress.getId(),"TrTaskProgress","id",resources.getId());
67 TrTaskProgress.copy(resources); 50 TrTaskProgress.copy(resources);
68 TrTaskProgressRepository.save(TrTaskProgress); 51 this.trTaskProgressRepository.save(TrTaskProgress);
69 } 52 }
70 53
71 @Override 54 @Override
72 @Transactional(rollbackFor = Exception.class) 55 @Transactional(rollbackFor = Exception.class)
73 public void delete(Long id) { 56 public void delete(Long id) {
74 Assert.notNull(id, "The given id must not be null!"); 57 Assert.notNull(id, "The given id must not be null!");
75 TrTaskProgress TrTaskProgress = TrTaskProgressRepository.findById(id).orElseThrow( 58 TrTaskProgress TrTaskProgress = this.trTaskProgressRepository.findById(id).orElseThrow(
76 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", TrTaskProgress.class, id), 1)); 59 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", TrTaskProgress.class, id), 1));
77 TrTaskProgressRepository.delete(TrTaskProgress); 60 this.trTaskProgressRepository.delete(TrTaskProgress);
78 } 61 }
79 62
80 @Override 63 @Override
81 public List<TrTaskProgressDTO> findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1) { 64 public List<TrTaskProgressDTO> findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1) {
82 return TrTaskProgressMapper.toDto(this.TrTaskProgressRepository.findByMemberIdAndTaskIdAndCompletionTime(memberId,taskId,time1)); 65 return this.trTaskProgressMapper.toDto(this.trTaskProgressRepository.findByMemberIdAndTaskIdAndCompletionTime(memberId,taskId,time1));
83 } 66 }
84 67
85 68
......
...@@ -14,5 +14,4 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat ...@@ -14,5 +14,4 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
14 14
15 List<Task> findByTaskTemplateId(Long taskTemplateId); 15 List<Task> findByTaskTemplateId(Long taskTemplateId);
16 16
17 // List<Task> findByTemplateId(Long taskTemplateId);
18 } 17 }
......
1 package com.topdraw.business.module.task.rest;
2
3 import com.topdraw.common.ResultInfo;
4 import com.topdraw.business.module.task.domain.Task;
5 import com.topdraw.business.module.task.service.TaskService;
6 import com.topdraw.business.module.task.service.dto.TaskQueryCriteria;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.data.domain.Pageable;
9 import org.springframework.validation.annotation.Validated;
10 import org.springframework.web.bind.annotation.*;
11 import io.swagger.annotations.*;
12
13 /**
14 * @author XiangHan
15 * @date 2021-10-22
16 */
17 @Api(tags = "Task管理")
18 @RestController
19 @RequestMapping("/api/Task")
20 public class TaskController {
21
22 @Autowired
23 private TaskService TaskService;
24
25 @GetMapping
26 @ApiOperation("查询Task")
27 public ResultInfo getTasks(TaskQueryCriteria criteria, Pageable pageable) {
28 return ResultInfo.successPage(TaskService.queryAll(criteria,pageable));
29 }
30
31 @GetMapping(value = "/all")
32 @ApiOperation("查询所有Task")
33 public ResultInfo getTasks(TaskQueryCriteria criteria) {
34 return ResultInfo.success(TaskService.queryAll(criteria));
35 }
36
37 @PostMapping
38 @ApiOperation("新增Task")
39 public ResultInfo create(@Validated @RequestBody Task resources) {
40 TaskService.create(resources);
41 return ResultInfo.success();
42 }
43
44 @PutMapping
45 @ApiOperation("修改Task")
46 public ResultInfo update(@Validated @RequestBody Task resources) {
47 TaskService.update(resources);
48 return ResultInfo.success();
49 }
50
51 @DeleteMapping(value = "/{id}")
52 @ApiOperation("删除Task")
53 public ResultInfo delete(@PathVariable Long id) {
54 TaskService.delete(id);
55 return ResultInfo.success();
56 }
57
58 }
...@@ -2,9 +2,6 @@ package com.topdraw.business.module.task.service; ...@@ -2,9 +2,6 @@ package com.topdraw.business.module.task.service;
2 2
3 import com.topdraw.business.module.task.domain.Task; 3 import com.topdraw.business.module.task.domain.Task;
4 import com.topdraw.business.module.task.service.dto.TaskDTO; 4 import com.topdraw.business.module.task.service.dto.TaskDTO;
5 import com.topdraw.business.module.task.service.dto.TaskQueryCriteria;
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,32 +11,16 @@ import java.util.List; ...@@ -14,32 +11,16 @@ import java.util.List;
14 public interface TaskService { 11 public interface TaskService {
15 12
16 /** 13 /**
17 * 查询数据分页
18 * @param criteria 条件参数
19 * @param pageable 分页参数
20 * @return Map<String,Object>
21 */
22 Map<String,Object> queryAll(TaskQueryCriteria criteria, Pageable pageable);
23
24 /**
25 * 查询所有数据不分页
26 * @param criteria 条件参数
27 * @return List<TaskDTO>
28 */
29 List<TaskDTO> queryAll(TaskQueryCriteria criteria);
30
31 /**
32 * 根据ID查询 14 * 根据ID查询
33 * @param id ID 15 * @param id ID
34 * @return TaskDTO 16 * @return TaskDTO
35 */ 17 */
36 TaskDTO findById(Long id); 18 TaskDTO findById(Long id);
37 19
38 void create(Task resources); 20 /**
39 21 *
40 void update(Task resources); 22 * @param taskTemplateId
41 23 * @return
42 void delete(Long id); 24 */
43
44 List<Task> findByTemplateId(Long taskTemplateId); 25 List<Task> findByTemplateId(Long taskTemplateId);
45 } 26 }
......
...@@ -16,69 +16,69 @@ public class TaskDTO implements Serializable { ...@@ -16,69 +16,69 @@ public class TaskDTO implements Serializable {
16 16
17 private Long id; 17 private Long id;
18 18
19 // 任务模板id 19 /** 任务模板id */
20 private Long taskTemplateId; 20 private Long taskTemplateId;
21 21
22 // 任务重复类型,-1:不限次;1:单次;>1:多次 22 /** 任务重复类型,-1:不限次;1:单次;>1:多次 */
23 private Integer taskRepeatType; 23 private Integer taskRepeatType;
24 24
25 // 任务每日重置 0:不重置;1:重置 25 /** 任务每日重置 0:不重置;1:重置 */
26 private Integer taskDailyReset; 26 private Integer taskDailyReset;
27 27
28 // 行为量(完成此任务需要多少次相同行为的触发) 28 /** 行为量(完成此任务需要多少次相同行为的触发) */
29 private Integer actionAmount; 29 private Integer actionAmount;
30 30
31 // 任务生效时间 31 /** 任务生效时间 */
32 private Timestamp validTime; 32 private Timestamp validTime;
33 33
34 // 任务失效时间 34 /** 任务失效时间 */
35 private LocalDateTime expireTime; 35 private LocalDateTime expireTime;
36 36
37 // 显示顺序 37 /** 显示顺序 */
38 private Integer sequence; 38 private Integer sequence;
39 39
40 // 获得成长值 40 /** 获得成长值 */
41 private Long rewardExp; 41 private Long rewardExp;
42 42
43 // 获得积分 43 /** 获得积分 */
44 private Long rewardPoints; 44 private Long rewardPoints;
45 45
46 // 积分过期时间(空为不过期) 46 /** 积分过期时间(空为不过期) */
47 private Long rewardPointsExpireTime; 47 private Long rewardPointsExpireTime;
48 48
49 // 能够获取该任务的用户分组,为空则都能获取 49 /** 能够获取该任务的用户分组,为空则都能获取 */
50 private String groups; 50 private String groups;
51 51
52 // 会员等级门槛(0表示无门槛) 52 /** 会员等级门槛(0表示无门槛) */
53 private Integer memberLevel; 53 private Integer memberLevel;
54 54
55 // 会员vip门槛(0表示没有门槛) 55 /** 会员vip门槛(0表示没有门槛) */
56 private Integer memberVip; 56 private Integer memberVip;
57 57
58 // 权益id 58 /** 权益id */
59 private Long rightsId; 59 private Long rightsId;
60 60
61 // 权益数量(活动机会次数、优惠券数量、奖品数量) 61 /** 权益数量(活动机会次数、优惠券数量、奖品数量) */
62 private Integer rightsAmount; 62 private Integer rightsAmount;
63 63
64 // 权益2id 64 /** 权益2id */
65 private Long rights2Id; 65 private Long rights2Id;
66 66
67 // 权益2数量 67 /** 权益2数量 */
68 private Integer rights2Amount; 68 private Integer rights2Amount;
69 69
70 // 权益3id 70 /** 权益3id */
71 private Long rights3Id; 71 private Long rights3Id;
72 72
73 // 权益3数量 73 /** 权益3数量 */
74 private Integer rights3Amount; 74 private Integer rights3Amount;
75 75
76 // 状态 0:失效;1:生效 76 /** 状态 0:失效;1:生效 */
77 private Integer status; 77 private Integer status;
78 78
79 // 创建时间 79 /** 创建时间 */
80 private Timestamp createTime; 80 private Timestamp createTime;
81 81
82 // 更新时间 82 /** 更新时间 */
83 private Timestamp updateTime; 83 private Timestamp updateTime;
84 } 84 }
......
1 package com.topdraw.business.module.task.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author XiangHan
7 * @date 2021-10-22
8 */
9 @Data
10 public class TaskQueryCriteria{
11 }
...@@ -5,21 +5,15 @@ import com.topdraw.utils.ValidationUtil; ...@@ -5,21 +5,15 @@ import com.topdraw.utils.ValidationUtil;
5 import com.topdraw.business.module.task.repository.TaskRepository; 5 import com.topdraw.business.module.task.repository.TaskRepository;
6 import com.topdraw.business.module.task.service.TaskService; 6 import com.topdraw.business.module.task.service.TaskService;
7 import com.topdraw.business.module.task.service.dto.TaskDTO; 7 import com.topdraw.business.module.task.service.dto.TaskDTO;
8 import com.topdraw.business.module.task.service.dto.TaskQueryCriteria;
9 import com.topdraw.business.module.task.service.mapper.TaskMapper; 8 import com.topdraw.business.module.task.service.mapper.TaskMapper;
10 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation; 11 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional; 12 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.dao.EmptyResultDataAccessException; 13 import org.springframework.dao.EmptyResultDataAccessException;
15 import org.springframework.data.domain.Page;
16 import org.springframework.data.domain.Pageable;
17 import org.springframework.util.Assert; 14 import org.springframework.util.Assert;
18 import com.topdraw.utils.PageUtil;
19 import com.topdraw.utils.QueryHelp;
20 15
21 import java.util.List; 16 import java.util.List;
22 import java.util.Map;
23 import java.util.Objects; 17 import java.util.Objects;
24 18
25 /** 19 /**
...@@ -31,57 +25,21 @@ import java.util.Objects; ...@@ -31,57 +25,21 @@ import java.util.Objects;
31 public class TaskServiceImpl implements TaskService { 25 public class TaskServiceImpl implements TaskService {
32 26
33 @Autowired 27 @Autowired
34 private TaskRepository TaskRepository; 28 private TaskMapper taskMapper;
35
36 @Autowired 29 @Autowired
37 private TaskMapper TaskMapper; 30 private TaskRepository taskRepository;
38
39 @Override
40 public Map<String, Object> queryAll(TaskQueryCriteria criteria, Pageable pageable) {
41 Page<Task> page = TaskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
42 return PageUtil.toPage(page.map(TaskMapper::toDto));
43 }
44 31
45 @Override
46 public List<TaskDTO> queryAll(TaskQueryCriteria criteria) {
47 return TaskMapper.toDto(TaskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
48 }
49 32
50 @Override 33 @Override
51 public TaskDTO findById(Long id) { 34 public TaskDTO findById(Long id) {
52 Task Task = TaskRepository.findById(id).orElseGet(Task::new); 35 Task Task = this.taskRepository.findById(id).orElseGet(Task::new);
53 ValidationUtil.isNull(Task.getId(),"Task","id",id); 36 ValidationUtil.isNull(Task.getId(),"Task","id",id);
54 return TaskMapper.toDto(Task); 37 return this.taskMapper.toDto(Task);
55 }
56
57 @Override
58 @Transactional(rollbackFor = Exception.class)
59 public void create(Task resources) {
60 TaskRepository.save(resources);
61 }
62
63 @Override
64 @Transactional(rollbackFor = Exception.class)
65 public void update(Task resources) {
66 Task Task = TaskRepository.findById(resources.getId()).orElseGet(Task::new);
67 ValidationUtil.isNull( Task.getId(),"Task","id",resources.getId());
68 Task.copy(resources);
69 TaskRepository.save(Task);
70 }
71
72 @Override
73 @Transactional(rollbackFor = Exception.class)
74 public void delete(Long id) {
75 Assert.notNull(id, "The given id must not be null!");
76 Task Task = TaskRepository.findById(id).orElseThrow(
77 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", Task.class, id), 1));
78 TaskRepository.delete(Task);
79 } 38 }
80 39
81 // @Cacheable(cacheNames = "uc-admin_taskList" , key = "#taskTemplateId")
82 @Override 40 @Override
83 public List<Task> findByTemplateId(Long taskTemplateId) { 41 public List<Task> findByTemplateId(Long taskTemplateId) {
84 return Objects.nonNull(taskTemplateId) ? this.TaskRepository.findByTaskTemplateId(taskTemplateId) : null; 42 return Objects.nonNull(taskTemplateId) ? this.taskRepository.findByTaskTemplateId(taskTemplateId) : null;
85 } 43 }
86 44
87 45
......
...@@ -30,96 +30,97 @@ public class UserTv extends AsyncMqModule implements Serializable { ...@@ -30,96 +30,97 @@ public class UserTv extends AsyncMqModule implements Serializable {
30 /** 绑定的小屏账户会员编码 */ 30 /** 绑定的小屏账户会员编码 */
31 @Column(name = "priority_member_code") 31 @Column(name = "priority_member_code")
32 private String priorityMemberCode; 32 private String priorityMemberCode;
33 // ID 33
34 /** ID */
34 @Id 35 @Id
35 @GeneratedValue(strategy = GenerationType.IDENTITY) 36 @GeneratedValue(strategy = GenerationType.IDENTITY)
36 @Column(name = "id") 37 @Column(name = "id")
37 private Long id; 38 private Long id;
38 39
39 // 人ID 40 /** 人ID */
40 @Column(name = "person_id") 41 @Column(name = "person_id")
41 private Long personId; 42 private Long personId;
42 43
43 // 运营商平台 44 /** 运营商平台 */
44 @Column(name = "platform") 45 @Column(name = "platform")
45 private String platform; 46 private String platform;
46 47
47 // 运营商平台账号 48 /** 运营商平台账号 */
48 @Column(name = "platform_account") 49 @Column(name = "platform_account")
49 @NotNull(message = "platformAccount can't be null !",groups = {CreateGroup.class}) 50 @NotNull(message = "platformAccount can't be null !",groups = {CreateGroup.class})
50 private String platformAccount; 51 private String platformAccount;
51 52
52 // 手机号 53 /** 手机号 */
53 @Column(name = "cellphone") 54 @Column(name = "cellphone")
54 private String cellphone; 55 private String cellphone;
55 56
56 // 用户名 57 /** 用户名 */
57 @Column(name = "username") 58 @Column(name = "username")
58 private String username; 59 private String username;
59 60
60 // 密码 MD5 61 /** 密码 MD5 */
61 @Column(name = "password") 62 @Column(name = "password")
62 private String password; 63 private String password;
63 64
64 // 昵称 Base64 65 /** 昵称 Base64 */
65 @Column(name = "nickname") 66 @Column(name = "nickname")
66 private String nickname; 67 private String nickname;
67 68
68 // 头像 69 /** 头像 */
69 @Column(name = "image") 70 @Column(name = "image")
70 private String image; 71 private String image;
71 72
72 // 登录天数(总天数) 73 /** 登录天数(总天数) */
73 @Column(name = "login_days") 74 @Column(name = "login_days")
74 private Integer loginDays; 75 private Integer loginDays;
75 76
76 // 连续登录天数 77 /** 连续登录天数 */
77 @Column(name = "continue_days") 78 @Column(name = "continue_days")
78 private Integer continueDays; 79 private Integer continueDays;
79 80
80 // 活跃时间 81 /** 活跃时间 */
81 @Column(name = "active_time") 82 @Column(name = "active_time")
82 private Timestamp activeTime; 83 private Timestamp activeTime;
83 84
84 // 分组 分组ID用逗号分隔 85 /** 分组 分组ID用逗号分隔 */
85 @Column(name = "groups") 86 @Column(name = "groups")
86 private String groups; 87 private String groups;
87 88
88 // 标签 标签用逗号分隔 89 /** 标签 标签用逗号分隔 */
89 @Column(name = "tags") 90 @Column(name = "tags")
90 private String tags; 91 private String tags;
91 92
92 // 登录类型 1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 93 /** 登录类型 1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 */
93 @Column(name = "login_type") 94 @Column(name = "login_type")
94 private Integer loginType; 95 private Integer loginType;
95 96
96 // 状态 0-下线 1-上线 97 /** 状态 0-下线 1-上线 */
97 @Column(name = "status") 98 @Column(name = "status")
98 private Integer status; 99 private Integer status;
99 100
100 // 描述 101 /** 描述 */
101 @Column(name = "description") 102 @Column(name = "description")
102 private String description; 103 private String description;
103 104
104 // 创建者 105 /** 创建者 */
105 @Column(name = "create_by") 106 @Column(name = "create_by")
106 private String createBy; 107 private String createBy;
107 108
108 // 创建时间 109 /** 创建时间 */
109 @CreatedDate 110 @CreatedDate
110 @Column(name = "create_time") 111 @Column(name = "create_time")
111 private Timestamp createTime; 112 private Timestamp createTime;
112 113
113 // 更新者 114 /** 更新者 */
114 @Column(name = "update_by") 115 @Column(name = "update_by")
115 private String updateBy; 116 private String updateBy;
116 117
117 // 更新时间 118 /** 更新时间 */
118 @LastModifiedDate 119 @LastModifiedDate
119 @Column(name = "update_time") 120 @Column(name = "update_time")
120 private Timestamp updateTime; 121 private Timestamp updateTime;
121 122
122 // 会员id 123 /** 会员id */
123 @Column(name = "member_id") 124 @Column(name = "member_id")
124 private Long memberId; 125 private Long memberId;
125 126
......
...@@ -71,5 +71,10 @@ public interface UserTvService { ...@@ -71,5 +71,10 @@ public interface UserTvService {
71 */ 71 */
72 boolean checkPriorityMemberByMemberIdOrMemberCode(Long memberId,String memberCode); 72 boolean checkPriorityMemberByMemberIdOrMemberCode(Long memberId,String memberCode);
73 73
74 /**
75 *
76 * @param platformAccount
77 * @return
78 */
74 MemberDTO findMemberByPlatformAccount(String platformAccount); 79 MemberDTO findMemberByPlatformAccount(String platformAccount);
75 } 80 }
......
...@@ -17,70 +17,70 @@ public class UserTvDTO implements Serializable { ...@@ -17,70 +17,70 @@ public class UserTvDTO implements Serializable {
17 /** 绑定的小屏账户会员编码 */ 17 /** 绑定的小屏账户会员编码 */
18 private String priorityMemberCode; 18 private String priorityMemberCode;
19 19
20 // ID 20 /** ID */
21 private Long id; 21 private Long id;
22 22
23 // 人ID 23 /** 人ID */
24 private Long personId; 24 private Long personId;
25 25
26 // 运营商平台 26 /** 运营商平台 */
27 private String platform; 27 private String platform;
28 28
29 // 运营商平台账号 29 /** 运营商平台账号 */
30 private String platformAccount; 30 private String platformAccount;
31 31
32 // 手机号 32 /** 手机号 */
33 private String cellphone; 33 private String cellphone;
34 34
35 // 用户名 35 /** 用户名 */
36 private String username; 36 private String username;
37 37
38 // 密码 MD5 38 /** 密码 MD5 */
39 private String password; 39 private String password;
40 40
41 // 昵称 Base64 41 /** 昵称 Base64 */
42 private String nickname; 42 private String nickname;
43 43
44 // 头像 44 /** 头像 */
45 private String image; 45 private String image;
46 46
47 // 登录天数(总天数) 47 /** 登录天数(总天数) */
48 private Integer loginDays; 48 private Integer loginDays;
49 49
50 // 连续登录天数 50 /** 连续登录天数 */
51 private Integer continueDays; 51 private Integer continueDays;
52 52
53 // 活跃时间 53 /** 活跃时间 */
54 private Timestamp activeTime; 54 private Timestamp activeTime;
55 55
56 // 分组 分组ID用逗号分隔 56 /** 分组 分组ID用逗号分隔 */
57 private String groups; 57 private String groups;
58 58
59 // 标签 标签用逗号分隔 59 /** 标签 标签用逗号分隔 */
60 private String tags; 60 private String tags;
61 61
62 // 登录类型 1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 62 /** 登录类型 1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 */
63 private Integer loginType; 63 private Integer loginType;
64 64
65 // 状态 0-下线 1-上线 65 /** 状态 0-下线 1-上线 */
66 private Integer status; 66 private Integer status;
67 67
68 // 描述 68 /** 描述 */
69 private String description; 69 private String description;
70 70
71 // 创建者 71 /** 创建者 */
72 private String createBy; 72 private String createBy;
73 73
74 // 创建时间 74 /** 创建时间 */
75 private Timestamp createTime; 75 private Timestamp createTime;
76 76
77 // 更新者 77 /** 更新者 */
78 private String updateBy; 78 private String updateBy;
79 79
80 // 更新时间 80 /** 更新时间 */
81 private Timestamp updateTime; 81 private Timestamp updateTime;
82 82
83 // 会员id 83 /** 会员id */
84 private Long memberId; 84 private Long memberId;
85 } 85 }
86 86
......
1 package com.topdraw.business.module.user.iptv.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author XiangHan
7 * @date 2021-12-16
8 */
9 @Data
10 public class UserTvQueryCriteria{
11 }
...@@ -153,7 +153,7 @@ public class UserTvServiceImpl implements UserTvService { ...@@ -153,7 +153,7 @@ public class UserTvServiceImpl implements UserTvService {
153 public boolean checkPriorityMemberByMemberIdOrMemberCode(Long memberId, String memberCode) { 153 public boolean checkPriorityMemberByMemberIdOrMemberCode(Long memberId, String memberCode) {
154 // 检查会员是否存在 154 // 检查会员是否存在
155 this.checkMember(memberId, memberCode); 155 this.checkMember(memberId, memberCode);
156 // 156
157 UserTvDTO userTvDTO = this.findByPriorityMemberCode(memberCode); 157 UserTvDTO userTvDTO = this.findByPriorityMemberCode(memberCode);
158 if (Objects.nonNull(userTvDTO)) { 158 if (Objects.nonNull(userTvDTO)) {
159 return true; 159 return true;
...@@ -165,5 +165,4 @@ public class UserTvServiceImpl implements UserTvService { ...@@ -165,5 +165,4 @@ public class UserTvServiceImpl implements UserTvService {
165 this.memberService.checkMember(memberId, memberCode); 165 this.memberService.checkMember(memberId, memberCode);
166 } 166 }
167 167
168
169 } 168 }
......
...@@ -23,38 +23,38 @@ import java.sql.Timestamp; ...@@ -23,38 +23,38 @@ import java.sql.Timestamp;
23 @Table(name="uc_user_collection") 23 @Table(name="uc_user_collection")
24 public class UserCollection implements Serializable { 24 public class UserCollection implements Serializable {
25 25
26 // ID 26 /** ID */
27 @Id 27 @Id
28 @GeneratedValue(strategy = GenerationType.IDENTITY) 28 @GeneratedValue(strategy = GenerationType.IDENTITY)
29 @Column(name = "id") 29 @Column(name = "id")
30 private Long id; 30 private Long id;
31 31
32 // 应用ID 32 /** 应用ID */
33 @Column(name = "app_id") 33 @Column(name = "app_id")
34 private Long appId; 34 private Long appId;
35 35
36 // 用户ID 36 /** 用户ID */
37 @Column(name = "user_id") 37 @Column(name = "user_id")
38 private Long userId; 38 private Long userId;
39 39
40 // 收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅 40 /** 收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅 */
41 @Column(name = "type") 41 @Column(name = "type")
42 private Integer type; 42 private Integer type;
43 43
44 // 收藏夹名称 44 /** 收藏夹名称 */
45 @Column(name = "name") 45 @Column(name = "name")
46 private String name; 46 private String name;
47 47
48 // 数量 48 /** 数量 */
49 @Column(name = "count") 49 @Column(name = "count")
50 private Integer count; 50 private Integer count;
51 51
52 // 创建时间 52 /** 创建时间 */
53 @CreatedDate 53 @CreatedDate
54 @Column(name = "create_time") 54 @Column(name = "create_time")
55 private Timestamp createTime; 55 private Timestamp createTime;
56 56
57 // 更新时间 57 /** 更新时间 */
58 @LastModifiedDate 58 @LastModifiedDate
59 @Column(name = "update_time") 59 @Column(name = "update_time")
60 private Timestamp updateTime; 60 private Timestamp updateTime;
......
...@@ -25,89 +25,89 @@ public class UserCollectionDetail implements Serializable { ...@@ -25,89 +25,89 @@ public class UserCollectionDetail implements Serializable {
25 @JoinColumn(name = "user_collection_id", insertable = false, updatable = false) 25 @JoinColumn(name = "user_collection_id", insertable = false, updatable = false)
26 private UserCollection userCollection; 26 private UserCollection userCollection;
27 27
28 // ID 28 /** ID */
29 @Id 29 @Id
30 @GeneratedValue(strategy = GenerationType.IDENTITY) 30 @GeneratedValue(strategy = GenerationType.IDENTITY)
31 @Column(name = "id") 31 @Column(name = "id")
32 private Long id; 32 private Long id;
33 33
34 // 收藏夹ID 34 /** 收藏夹ID */
35 @Column(name = "user_collection_id") 35 @Column(name = "user_collection_id")
36 private Long userCollectionId; 36 private Long userCollectionId;
37 37
38 // 自定义收藏内容的类型CODE,默认:DEFAULT 38 /** 自定义收藏内容的类型CODE,默认:DEFAULT */
39 @Column(name = "detail_folder_code") 39 @Column(name = "detail_folder_code")
40 private String detailFolderCode; 40 private String detailFolderCode;
41 41
42 // 收藏内容的类型:MEDIA|EPISODE|CATEGORY|SUBJECT|ARTICLE|ARTIST|SCHOOL 42 /** 收藏内容的类型:MEDIA|EPISODE|CATEGORY|SUBJECT|ARTICLE|ARTIST|SCHOOL */
43 @Column(name = "detail_type") 43 @Column(name = "detail_type")
44 private String detailType; 44 private String detailType;
45 45
46 // 收藏内容的ID 46 /** 收藏内容的ID */
47 @Column(name = "detail_id") 47 @Column(name = "detail_id")
48 private Long detailId; 48 private Long detailId;
49 49
50 // 收藏内容的CODE 50 /** 收藏内容的CODE */
51 @Column(name = "detail_code") 51 @Column(name = "detail_code")
52 private String detailCode; 52 private String detailCode;
53 53
54 // 收藏内容的剧集ID 54 /** 收藏内容的剧集ID */
55 @Column(name = "detail_episode_id") 55 @Column(name = "detail_episode_id")
56 private Long detailEpisodeId; 56 private Long detailEpisodeId;
57 57
58 // 收藏内容的剧集CODE 58 /** 收藏内容的剧集CODE */
59 @Column(name = "detail_episode_code") 59 @Column(name = "detail_episode_code")
60 private String detailEpisodeCode; 60 private String detailEpisodeCode;
61 61
62 // 收藏内容的名称 62 /** 收藏内容的名称 */
63 @Column(name = "detail_name") 63 @Column(name = "detail_name")
64 private String detailName; 64 private String detailName;
65 65
66 // 收藏内容的标记 66 /** 收藏内容的标记 */
67 @Column(name = "detail_mark") 67 @Column(name = "detail_mark")
68 private Integer detailMark; 68 private Integer detailMark;
69 69
70 // 收藏内容的图片 70 /** 收藏内容的图片 */
71 @Column(name = "detail_img") 71 @Column(name = "detail_img")
72 private String detailImg; 72 private String detailImg;
73 73
74 // 收藏内容的剧集序号 74 /** 收藏内容的剧集序号 */
75 @Column(name = "detail_index") 75 @Column(name = "detail_index")
76 private Integer detailIndex; 76 private Integer detailIndex;
77 77
78 // 收藏内容的剧集总数 78 /** 收藏内容的剧集总数 */
79 @Column(name = "detail_total_index") 79 @Column(name = "detail_total_index")
80 private Integer detailTotalIndex; 80 private Integer detailTotalIndex;
81 81
82 // 收藏内容的播放时间 82 /** 收藏内容的播放时间 */
83 @Column(name = "detail_play_time") 83 @Column(name = "detail_play_time")
84 private Integer detailPlayTime; 84 private Integer detailPlayTime;
85 85
86 // 收藏内容的总时间 86 /** 收藏内容的总时间 */
87 @Column(name = "detail_total_time") 87 @Column(name = "detail_total_time")
88 private Integer detailTotalTime; 88 private Integer detailTotalTime;
89 89
90 // 收藏内容在同一folder中的顺序 90 /** 收藏内容在同一folder中的顺序 */
91 @Column(name = "detail_sequence") 91 @Column(name = "detail_sequence")
92 private Integer detailSequence; 92 private Integer detailSequence;
93 93
94 // 收藏内容的评分 94 /** 收藏内容的评分 */
95 @Column(name = "detail_score") 95 @Column(name = "detail_score")
96 private Float detailScore; 96 private Float detailScore;
97 97
98 // 收藏内容(根据文件夹和类型的不同)的点赞/关注/订阅 98 /** 收藏内容(根据文件夹和类型的不同)的点赞/关注/订阅 */
99 @Column(name = "detail_like") 99 @Column(name = "detail_like")
100 private Integer detailLike; 100 private Integer detailLike;
101 101
102 // 收藏内容的扩展数据 102 /** 收藏内容的扩展数据 */
103 @Column(name = "detail_ext_data") 103 @Column(name = "detail_ext_data")
104 private String detailExtData; 104 private String detailExtData;
105 105
106 // 创建时间 106 /** 创建时间 */
107 @Column(name = "create_time") 107 @Column(name = "create_time")
108 private Timestamp createTime; 108 private Timestamp createTime;
109 109
110 // 更新时间 110 /** 更新时间 */
111 @Column(name = "update_time") 111 @Column(name = "update_time")
112 private Timestamp updateTime; 112 private Timestamp updateTime;
113 113
......
...@@ -14,8 +14,6 @@ import java.util.Optional; ...@@ -14,8 +14,6 @@ import java.util.Optional;
14 */ 14 */
15 public interface UserCollectionRepository extends JpaRepository<UserCollection, Long>, JpaSpecificationExecutor<UserCollection> { 15 public interface UserCollectionRepository extends JpaRepository<UserCollection, Long>, JpaSpecificationExecutor<UserCollection> {
16 16
17 Optional<UserCollection> findFirstByUserIdAndTypeAndName(Long userId, Integer type, String name);
18
19 List<UserCollection> findByUserIdAndType(Long userId, Integer type); 17 List<UserCollection> findByUserIdAndType(Long userId, Integer type);
20 18
21 } 19 }
......
...@@ -2,11 +2,8 @@ package com.topdraw.business.module.user.weixin.collection.service; ...@@ -2,11 +2,8 @@ package com.topdraw.business.module.user.weixin.collection.service;
2 2
3 import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail; 3 import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail;
4 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailDTO; 4 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailDTO;
5 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailQueryCriteria;
6 import org.springframework.data.domain.Pageable;
7 5
8 import java.util.List; 6 import java.util.List;
9 import java.util.Map;
10 7
11 /** 8 /**
12 * @author pengmengqing 9 * @author pengmengqing
...@@ -15,27 +12,40 @@ import java.util.Map; ...@@ -15,27 +12,40 @@ import java.util.Map;
15 public interface UserCollectionDetailService { 12 public interface UserCollectionDetailService {
16 13
17 /** 14 /**
18 * 查询数据分页
19 * @param criteria 条件参数
20 * @param pageable 分页参数
21 * @return Map<String,Object>
22 */
23 Map<String,Object> queryAll(UserCollectionDetailQueryCriteria criteria, Pageable pageable);
24
25 /**
26 * 根据ID查询 15 * 根据ID查询
27 * @param id ID 16 * @param id ID
28 * @return UserCollectionDetailDTO 17 * @return UserCollectionDetailDTO
29 */ 18 */
30 UserCollectionDetailDTO findById(Long id); 19 UserCollectionDetailDTO findById(Long id);
31 20
21 /**
22 *
23 * @param resources
24 * @return
25 */
32 UserCollectionDetailDTO create(UserCollectionDetail resources); 26 UserCollectionDetailDTO create(UserCollectionDetail resources);
33 27
28 /**
29 *
30 * @param resources
31 */
34 void update(UserCollectionDetail resources); 32 void update(UserCollectionDetail resources);
35 33
34 /**
35 *
36 * @param id
37 */
36 void delete(Long id); 38 void delete(Long id);
37 39
40 /**
41 *
42 * @param id
43 */
38 void deleteAllByUserCollectionId(Long id); 44 void deleteAllByUserCollectionId(Long id);
39 45
46 /**
47 *
48 * @param userCollectionDetailOptional
49 */
40 void deleteAll(List<UserCollectionDetail> userCollectionDetailOptional); 50 void deleteAll(List<UserCollectionDetail> userCollectionDetailOptional);
41 } 51 }
......
...@@ -2,13 +2,10 @@ package com.topdraw.business.module.user.weixin.collection.service; ...@@ -2,13 +2,10 @@ package com.topdraw.business.module.user.weixin.collection.service;
2 2
3 import com.topdraw.business.module.user.weixin.collection.domain.UserCollection; 3 import com.topdraw.business.module.user.weixin.collection.domain.UserCollection;
4 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDTO; 4 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDTO;
5 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionQueryCriteria;
6 import org.springframework.data.domain.Pageable;
7 5
8 import javax.servlet.http.HttpServletResponse; 6 import javax.servlet.http.HttpServletResponse;
9 import java.io.IOException; 7 import java.io.IOException;
10 import java.util.List; 8 import java.util.List;
11 import java.util.Map;
12 import java.util.Optional; 9 import java.util.Optional;
13 10
14 /** 11 /**
...@@ -18,38 +15,60 @@ import java.util.Optional; ...@@ -18,38 +15,60 @@ import java.util.Optional;
18 public interface UserCollectionService { 15 public interface UserCollectionService {
19 16
20 /** 17 /**
21 * 查询数据分页
22 * @param criteria 条件参数
23 * @param pageable 分页参数
24 * @return Map<String,Object>
25 */
26 Map<String,Object> queryAll(UserCollectionQueryCriteria criteria, Pageable pageable);
27
28 /**
29 * 查询所有数据不分页
30 * @param criteria 条件参数
31 * @return List<UserCollectionDTO>
32 */
33 List<UserCollectionDTO> queryAll(UserCollectionQueryCriteria criteria);
34
35 /**
36 * 根据ID查询 18 * 根据ID查询
37 * @param id ID 19 * @param id ID
38 * @return UserCollectionDTO 20 * @return UserCollectionDTO
39 */ 21 */
40 UserCollectionDTO findById(Long id); 22 UserCollectionDTO findById(Long id);
41 23
24 /**
25 *
26 * @param resources
27 * @return
28 */
42 UserCollectionDTO create(UserCollection resources); 29 UserCollectionDTO create(UserCollection resources);
43 30
31 /**
32 *
33 * @param resources
34 */
44 void update(UserCollection resources); 35 void update(UserCollection resources);
45 36
37 /**
38 *
39 * @param id
40 */
46 void delete(Long id); 41 void delete(Long id);
47 42
43 /**
44 *
45 * @param all
46 * @param response
47 * @throws IOException
48 */
48 void download(List<UserCollectionDTO> all, HttpServletResponse response) throws IOException; 49 void download(List<UserCollectionDTO> all, HttpServletResponse response) throws IOException;
49 50
51 /**
52 *
53 * @param id
54 * @param type
55 * @return
56 */
50 List<UserCollection> findByUserIdAndType(Long id, Integer type); 57 List<UserCollection> findByUserIdAndType(Long id, Integer type);
51 58
59 /**
60 *
61 * @param id
62 * @param type
63 * @param name
64 * @return
65 */
52 Optional<UserCollection> findFirstByUserIdAndTypeAndName(Long id, Integer type, String name); 66 Optional<UserCollection> findFirstByUserIdAndTypeAndName(Long id, Integer type, String name);
53 67
68 /**
69 *
70 * @param userCollection
71 * @return
72 */
54 UserCollection save(UserCollection userCollection); 73 UserCollection save(UserCollection userCollection);
55 } 74 }
......
...@@ -13,27 +13,27 @@ import java.sql.Timestamp; ...@@ -13,27 +13,27 @@ import java.sql.Timestamp;
13 @Data 13 @Data
14 public class UserCollectionDTO implements Serializable { 14 public class UserCollectionDTO implements Serializable {
15 15
16 // ID 16 /** ID */
17 private Long id; 17 private Long id;
18 18
19 // 应用ID 19 /** 应用ID */
20 private Long appId; 20 private Long appId;
21 21
22 // 用户ID 22 /** 用户ID */
23 private Long userId; 23 private Long userId;
24 24
25 // 收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅 25 /** 收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅 */
26 private Integer type; 26 private Integer type;
27 27
28 // 收藏夹名称 28 /** 收藏夹名称 */
29 private String name; 29 private String name;
30 30
31 // 数量 31 /** 数量 */
32 private Integer count; 32 private Integer count;
33 33
34 // 创建时间 34 /** 创建时间 */
35 private Timestamp createTime; 35 private Timestamp createTime;
36 36
37 // 更新时间 37 /** 更新时间 */
38 private Timestamp updateTime; 38 private Timestamp updateTime;
39 } 39 }
......
...@@ -14,71 +14,71 @@ import java.sql.Timestamp; ...@@ -14,71 +14,71 @@ import java.sql.Timestamp;
14 @Data 14 @Data
15 public class UserCollectionDetailDTO implements Serializable { 15 public class UserCollectionDetailDTO implements Serializable {
16 16
17 // ID 17 /** ID */
18 private Long id; 18 private Long id;
19 19
20 // 收藏夹ID 20 /** 收藏夹ID */
21 private Long userCollectionId; 21 private Long userCollectionId;
22 22
23 // 自定义收藏内容的类型CODE,默认:DEFAULT 23 /** 自定义收藏内容的类型CODE,默认:DEFAULT */
24 private String detailFolderCode; 24 private String detailFolderCode;
25 25
26 // 收藏内容的类型:MEDIA|EPISODE|CATEGORY|SUBJECT|ARTICLE|ARTIST|SCHOOL 26 /** 收藏内容的类型:MEDIA|EPISODE|CATEGORY|SUBJECT|ARTICLE|ARTIST|SCHOOL */
27 private String detailType; 27 private String detailType;
28 28
29 // 收藏内容的ID 29 /** 收藏内容的ID */
30 private Long detailId; 30 private Long detailId;
31 31
32 // 收藏内容的CODE 32 /** 收藏内容的CODE */
33 private String detailCode; 33 private String detailCode;
34 34
35 // 收藏内容的剧集ID 35 /** 收藏内容的剧集ID */
36 private Long detailEpisodeId; 36 private Long detailEpisodeId;
37 37
38 // 收藏内容的剧集CODE 38 /** 收藏内容的剧集CODE */
39 private String detailEpisodeCode; 39 private String detailEpisodeCode;
40 40
41 // 收藏内容的名称 41 /** 收藏内容的名称 */
42 private String detailName; 42 private String detailName;
43 43
44 // 收藏内容的标记 44 /** 收藏内容的标记 */
45 private Integer detailMark; 45 private Integer detailMark;
46 46
47 // 收藏内容的图片 47 /** 收藏内容的图片 */
48 private String detailImg; 48 private String detailImg;
49 49
50 // 收藏内容的剧集序号 50 /** 收藏内容的剧集序号 */
51 private Integer detailIndex; 51 private Integer detailIndex;
52 52
53 // 收藏内容的剧集总数 53 /** 收藏内容的剧集总数 */
54 private Integer detailTotalIndex; 54 private Integer detailTotalIndex;
55 55
56 // 收藏内容的播放时间 56 /** 收藏内容的播放时间 */
57 private Integer detailPlayTime; 57 private Integer detailPlayTime;
58 58
59 // 收藏内容的总时间 59 /** 收藏内容的总时间 */
60 private Integer detailTotalTime; 60 private Integer detailTotalTime;
61 61
62 // 收藏内容在同一folder中的顺序 62 /** 收藏内容在同一folder中的顺序 */
63 private Integer detailSequence; 63 private Integer detailSequence;
64 64
65 // 收藏内容的评分 65 /** 收藏内容的评分 */
66 private Float detailScore; 66 private Float detailScore;
67 67
68 // 收藏内容(根据文件夹和类型的不同)的点赞/关注/订阅 68 /** 收藏内容(根据文件夹和类型的不同)的点赞/关注/订阅 */
69 private Integer detailLike; 69 private Integer detailLike;
70 70
71 // 收藏内容的扩展数据 71 /** 收藏内容的扩展数据 */
72 private String detailExtData; 72 private String detailExtData;
73 73
74 // 创建时间 74 /** 创建时间 */
75 @JsonFormat( 75 @JsonFormat(
76 pattern = "MM月dd日 HH:mm", 76 pattern = "MM月dd日 HH:mm",
77 timezone = "GMT+8" 77 timezone = "GMT+8"
78 ) 78 )
79 private Timestamp createTime; 79 private Timestamp createTime;
80 80
81 // 更新时间 81 /** 更新时间 */
82 @JsonFormat( 82 @JsonFormat(
83 pattern = "MM月dd日 HH:mm", 83 pattern = "MM月dd日 HH:mm",
84 timezone = "GMT+8" 84 timezone = "GMT+8"
......
1 package com.topdraw.business.module.user.weixin.collection.service.dto;
2
3 import com.topdraw.annotation.Query;
4 import lombok.Data;
5
6 import javax.persistence.criteria.JoinType;
7
8 /**
9 * @author pengmengqing
10 * @date 2021-04-02
11 */
12 @Data
13 public class UserCollectionDetailQueryCriteria{
14
15 private Long userWeixinId;
16
17
18 @Query(joinType = JoinType.INNER, joinName = "userCollection")
19 private Long userId;
20
21 @Query(joinType = JoinType.INNER, joinName = "userCollection")
22 private Integer type;
23
24 private String detailType;
25
26 private String detailFolderCode = "DEFAULT";
27
28 private Long detailId;
29 }
1 package com.topdraw.business.module.user.weixin.collection.service.dto;
2
3 import lombok.Data;
4
5 /**
6 * @author pengmengqing
7 * @date 2021-04-02
8 */
9 @Data
10 public class UserCollectionQueryCriteria{
11 }
...@@ -4,13 +4,10 @@ import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionD ...@@ -4,13 +4,10 @@ import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionD
4 import com.topdraw.business.module.user.weixin.collection.repository.UserCollectionDetailRepository; 4 import com.topdraw.business.module.user.weixin.collection.repository.UserCollectionDetailRepository;
5 import com.topdraw.business.module.user.weixin.collection.service.UserCollectionDetailService; 5 import com.topdraw.business.module.user.weixin.collection.service.UserCollectionDetailService;
6 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailDTO; 6 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailDTO;
7 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailQueryCriteria;
8 import com.topdraw.business.module.user.weixin.collection.service.mapper.UserCollectionDetailMapper; 7 import com.topdraw.business.module.user.weixin.collection.service.mapper.UserCollectionDetailMapper;
9 import com.topdraw.utils.*; 8 import com.topdraw.utils.*;
10 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.dao.EmptyResultDataAccessException; 10 import org.springframework.dao.EmptyResultDataAccessException;
12 import org.springframework.data.domain.Page;
13 import org.springframework.data.domain.Pageable;
14 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
15 import org.springframework.transaction.annotation.Propagation; 12 import org.springframework.transaction.annotation.Propagation;
16 import org.springframework.transaction.annotation.Transactional; 13 import org.springframework.transaction.annotation.Transactional;
...@@ -28,15 +25,9 @@ public class UserCollectionDetailServiceImpl implements UserCollectionDetailServ ...@@ -28,15 +25,9 @@ public class UserCollectionDetailServiceImpl implements UserCollectionDetailServ
28 25
29 @Autowired 26 @Autowired
30 private UserCollectionDetailRepository userCollectionDetailRepository; 27 private UserCollectionDetailRepository userCollectionDetailRepository;
31
32 @Autowired 28 @Autowired
33 private UserCollectionDetailMapper userCollectionDetailMapper; 29 private UserCollectionDetailMapper userCollectionDetailMapper;
34 30
35 @Override
36 public Map<String, Object> queryAll(UserCollectionDetailQueryCriteria criteria, Pageable pageable) {
37 Page<UserCollectionDetail> page = userCollectionDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
38 return PageUtil.toPage(page.map(userCollectionDetailMapper::toDto));
39 }
40 31
41 @Override 32 @Override
42 public UserCollectionDetailDTO findById(Long id) { 33 public UserCollectionDetailDTO findById(Long id) {
......
...@@ -4,16 +4,11 @@ import com.topdraw.business.module.user.weixin.collection.domain.UserCollection; ...@@ -4,16 +4,11 @@ import com.topdraw.business.module.user.weixin.collection.domain.UserCollection;
4 import com.topdraw.business.module.user.weixin.collection.repository.UserCollectionRepository; 4 import com.topdraw.business.module.user.weixin.collection.repository.UserCollectionRepository;
5 import com.topdraw.business.module.user.weixin.collection.service.UserCollectionService; 5 import com.topdraw.business.module.user.weixin.collection.service.UserCollectionService;
6 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDTO; 6 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDTO;
7 import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionQueryCriteria;
8 import com.topdraw.business.module.user.weixin.collection.service.mapper.UserCollectionMapper; 7 import com.topdraw.business.module.user.weixin.collection.service.mapper.UserCollectionMapper;
9 import com.topdraw.utils.FileUtil; 8 import com.topdraw.utils.FileUtil;
10 import com.topdraw.utils.PageUtil;
11 import com.topdraw.utils.QueryHelp;
12 import com.topdraw.utils.ValidationUtil; 9 import com.topdraw.utils.ValidationUtil;
13 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.dao.EmptyResultDataAccessException; 11 import org.springframework.dao.EmptyResultDataAccessException;
15 import org.springframework.data.domain.Page;
16 import org.springframework.data.domain.Pageable;
17 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
18 import org.springframework.transaction.annotation.Propagation; 13 import org.springframework.transaction.annotation.Propagation;
19 import org.springframework.transaction.annotation.Transactional; 14 import org.springframework.transaction.annotation.Transactional;
...@@ -37,19 +32,6 @@ public class UserCollectionServiceImpl implements UserCollectionService { ...@@ -37,19 +32,6 @@ public class UserCollectionServiceImpl implements UserCollectionService {
37 @Autowired 32 @Autowired
38 private UserCollectionMapper userCollectionMapper; 33 private UserCollectionMapper userCollectionMapper;
39 34
40
41
42 @Override
43 public Map<String, Object> queryAll(UserCollectionQueryCriteria criteria, Pageable pageable) {
44 Page<UserCollection> page = userCollectionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
45 return PageUtil.toPage(page.map(userCollectionMapper::toDto));
46 }
47
48 @Override
49 public List<UserCollectionDTO> queryAll(UserCollectionQueryCriteria criteria) {
50 return userCollectionMapper.toDto(userCollectionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
51 }
52
53 @Override 35 @Override
54 public UserCollectionDTO findById(Long id) { 36 public UserCollectionDTO findById(Long id) {
55 UserCollection userCollection = userCollectionRepository.findById(id).orElseGet(UserCollection::new); 37 UserCollection userCollection = userCollectionRepository.findById(id).orElseGet(UserCollection::new);
......
...@@ -27,114 +27,114 @@ import java.io.Serializable; ...@@ -27,114 +27,114 @@ import java.io.Serializable;
27 @Table(name="uc_user_weixin") 27 @Table(name="uc_user_weixin")
28 public class UserWeixin extends AsyncMqModule implements Serializable { 28 public class UserWeixin extends AsyncMqModule implements Serializable {
29 29
30 // ID 30 /** ID */
31 @Id 31 @Id
32 @GeneratedValue(strategy = GenerationType.IDENTITY) 32 @GeneratedValue(strategy = GenerationType.IDENTITY)
33 @Column(name = "id") 33 @Column(name = "id")
34 private Long id; 34 private Long id;
35 35
36 // 用户ID 36 /** 用户ID */
37 @Column(name = "member_id") 37 @Column(name = "member_id")
38 private Long memberId; 38 private Long memberId;
39 39
40 // 微信unionid,针对开发者 40 /** 微信unionid,针对开发者 */
41 @Column(name = "unionid") 41 @Column(name = "unionid")
42 @NotNull(message = "unionid can't be null",groups = {CreateGroup.class}) 42 @NotNull(message = "unionid can't be null",groups = {CreateGroup.class})
43 private String unionid; 43 private String unionid;
44 44
45 // 微信appid 45 /** 微信appid */
46 @Column(name = "appid") 46 @Column(name = "appid")
47 @NotNull(message = "appid can't be null",groups = {CreateGroup.class}) 47 @NotNull(message = "appid can't be null",groups = {CreateGroup.class})
48 private String appid; 48 private String appid;
49 49
50 // 微信openid,针对微信app 50 /** 微信openid,针对微信app */
51 @Column(name = "openid") 51 @Column(name = "openid")
52 @NotNull(message = "openid can't be null",groups = {CreateGroup.class}) 52 @NotNull(message = "openid can't be null",groups = {CreateGroup.class})
53 private String openid; 53 private String openid;
54 54
55 // 关注状态 0 -未关注 1 - 已关注 55 /** 关注状态 0 -未关注 1 - 已关注 */
56 @Column(name = "status") 56 @Column(name = "status")
57 private Integer status; 57 private Integer status;
58 58
59 // 关注同步状态 0-未同步,1-已同步 59 /** 关注同步状态 0-未同步,1-已同步 */
60 @Column(name = "sync_status") 60 @Column(name = "sync_status")
61 private Integer syncStatus; 61 private Integer syncStatus;
62 62
63 // 昵称 63 /** 昵称 */
64 @Column(name = "nickname") 64 @Column(name = "nickname")
65 private String nickname; 65 private String nickname;
66 66
67 // 头像地址 67 /** 头像地址 */
68 @Column(name = "headimgurl") 68 @Column(name = "headimgurl")
69 private String headimgurl; 69 private String headimgurl;
70 70
71 // 特权信息 71 /** 特权信息 */
72 @Column(name = "privilege") 72 @Column(name = "privilege")
73 private String privilege; 73 private String privilege;
74 74
75 // 刷新凭据 75 /** 刷新凭据 */
76 @Column(name = "refresh_token") 76 @Column(name = "refresh_token")
77 private String refreshToken; 77 private String refreshToken;
78 78
79 // 凭据 79 /** 凭据 */
80 @Column(name = "access_token") 80 @Column(name = "access_token")
81 private String accessToken; 81 private String accessToken;
82 82
83 // 超时(秒) 83 /** 超时(秒) */
84 @Column(name = "expires_in") 84 @Column(name = "expires_in")
85 private Integer expiresIn; 85 private Integer expiresIn;
86 86
87 // 超时时间 87 /** 超时时间 */
88 @Column(name = "expires_time") 88 @Column(name = "expires_time")
89 private Timestamp expiresTime; 89 private Timestamp expiresTime;
90 90
91 // 描述 91 /** 描述 */
92 @Column(name = "description") 92 @Column(name = "description")
93 private String description; 93 private String description;
94 94
95 // 创建者 95 /** 创建者 */
96 @Column(name = "create_by") 96 @Column(name = "create_by")
97 private String createBy; 97 private String createBy;
98 98
99 // 创建时间 99 /** 创建时间 */
100 @CreatedDate 100 @CreatedDate
101 @Column(name = "create_time") 101 @Column(name = "create_time")
102 private Timestamp createTime; 102 private Timestamp createTime;
103 103
104 // 更新者 104 /** 更新者 */
105 @Column(name = "update_by") 105 @Column(name = "update_by")
106 private String updateBy; 106 private String updateBy;
107 107
108 // 更新时间 108 /** 更新时间 */
109 @LastModifiedDate 109 @LastModifiedDate
110 @Column(name = "update_time") 110 @Column(name = "update_time")
111 private Timestamp updateTime; 111 private Timestamp updateTime;
112 112
113 // 来源类型 113 /** 来源类型 */
114 @Column(name = "source_type") 114 @Column(name = "source_type")
115 private String sourceType; 115 private String sourceType;
116 116
117 // 来源id 117 /** 来源id */
118 @Column(name = "source_id") 118 @Column(name = "source_id")
119 private String sourceId; 119 private String sourceId;
120 120
121 // 来源id 121 /** 来源id */
122 @Column(name = "source_desc") 122 @Column(name = "source_desc")
123 private String sourceDesc; 123 private String sourceDesc;
124 124
125 // 人id 125 /** 人id */
126 @Column(name = "person_id") 126 @Column(name = "person_id")
127 private Long personId; 127 private Long personId;
128 128
129 // 来源用户id 129 /** 来源用户id */
130 @Column(name = "source_user") 130 @Column(name = "source_user")
131 private Long sourceUser; 131 private Long sourceUser;
132 132
133 // 来源实体:活动-activity/商品-item 133 /** 来源实体:活动-activity/商品-item */
134 @Column(name = "source_entity") 134 @Column(name = "source_entity")
135 private String sourceEntity; 135 private String sourceEntity;
136 136
137 // 授权时间 137 /** 授权时间 */
138 @Column(name = "auth_time") 138 @Column(name = "auth_time")
139 private Timestamp authTime; 139 private Timestamp authTime;
140 140
......
...@@ -28,6 +28,6 @@ public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, J ...@@ -28,6 +28,6 @@ public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, J
28 28
29 @Modifying 29 @Modifying
30 @Transactional 30 @Transactional
31 @Query(value = "update uc_user_weixin set update_time = :#{#resources.updateTime} where appid = :#{#resources.appid} and openid = :#{#resources.openid}" , nativeQuery = true) 31 @Query(value = "update `uc_user_weixin` set update_time = :#{#resources.updateTime} where appid = :#{#resources.appid} and openid = :#{#resources.openid}" , nativeQuery = true)
32 void updateTime(@Param("resources") UserWeixin resources); 32 void updateTime(@Param("resources") UserWeixin resources);
33 } 33 }
......
...@@ -5,7 +5,6 @@ import com.topdraw.common.ResultInfo; ...@@ -5,7 +5,6 @@ import com.topdraw.common.ResultInfo;
5 import com.topdraw.business.module.user.weixin.domain.UserWeixin; 5 import com.topdraw.business.module.user.weixin.domain.UserWeixin;
6 import com.topdraw.business.module.user.weixin.service.UserWeixinService; 6 import com.topdraw.business.module.user.weixin.service.UserWeixinService;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.data.domain.Pageable;
9 import org.springframework.validation.annotation.Validated; 8 import org.springframework.validation.annotation.Validated;
10 import org.springframework.web.bind.annotation.*; 9 import org.springframework.web.bind.annotation.*;
11 import io.swagger.annotations.*; 10 import io.swagger.annotations.*;
......
...@@ -16,21 +16,68 @@ public interface UserWeixinService { ...@@ -16,21 +16,68 @@ public interface UserWeixinService {
16 */ 16 */
17 UserWeixinDTO findById(Long id); 17 UserWeixinDTO findById(Long id);
18 18
19 /**
20 *
21 * @param resources
22 * @return
23 */
19 UserWeixin create(UserWeixin resources); 24 UserWeixin create(UserWeixin resources);
20 25
26 /**
27 *
28 * @param resources
29 */
21 void update(UserWeixin resources); 30 void update(UserWeixin resources);
22 31
32 /**
33 *
34 * @param resources
35 */
23 void updateTime(UserWeixin resources); 36 void updateTime(UserWeixin resources);
24 37
38 /**
39 *
40 * @param id
41 */
25 void delete(Long id); 42 void delete(Long id);
26 43
44 /**
45 *
46 * @param memberId
47 * @param appid
48 * @return
49 */
27 UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid); 50 UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid);
28 51
52 /**
53 *
54 * @param unionId
55 * @param appId
56 * @param openId
57 * @return
58 */
29 UserWeixinDTO findFirstByUnionIdAndAppIdAndOpenId(String unionId, String appId, String openId); 59 UserWeixinDTO findFirstByUnionIdAndAppIdAndOpenId(String unionId, String appId, String openId);
30 60
61 /**
62 *
63 * @param appId
64 * @param openId
65 * @return
66 */
31 UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId); 67 UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId);
32 68
69 /**
70 *
71 * @param unionid
72 * @return
73 */
33 UserWeixinDTO findFirstByUnionId(String unionid); 74 UserWeixinDTO findFirstByUnionId(String unionid);
34 75
76 /**
77 *
78 * @param unionid
79 * @param appId
80 * @return
81 */
35 UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId); 82 UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId);
36 } 83 }
......
...@@ -16,82 +16,82 @@ import java.io.Serializable; ...@@ -16,82 +16,82 @@ import java.io.Serializable;
16 @Data 16 @Data
17 public class UserWeixinDTO implements Serializable { 17 public class UserWeixinDTO implements Serializable {
18 18
19 // ID 19 /** ID */
20 private Long id; 20 private Long id;
21 21
22 // 用户ID 22 /** 用户ID */
23 private Long memberId; 23 private Long memberId;
24 24
25 // 微信unionid,针对开发者 25 /** 微信unionid,针对开发者 */
26 private String unionid; 26 private String unionid;
27 27
28 // 微信appid 28 /** 微信appid */
29 private String appid; 29 private String appid;
30 30
31 // 微信openid,针对微信app 31 /** 微信openid,针对微信app */
32 private String openid; 32 private String openid;
33 33
34 // 关注状态 0 -未关注 1 - 已关注 34 /** 关注状态 0 -未关注 1 - 已关注 */
35 private Integer status; 35 private Integer status;
36 36
37 // 关注同步状态 0-未同步,1-已同步 37 /** 关注同步状态 0-未同步,1-已同步 */
38 private Integer syncStatus; 38 private Integer syncStatus;
39 39
40 // 昵称 40 /** 昵称 */
41 private String nickname; 41 private String nickname;
42 42
43 // 头像地址 43 /** 头像地址 */
44 private String headimgurl; 44 private String headimgurl;
45 45
46 // 特权信息 46 /** 特权信息 */
47 private String privilege; 47 private String privilege;
48 48
49 // 刷新凭据 49 /** 刷新凭据 */
50 private String refreshToken; 50 private String refreshToken;
51 51
52 // 凭据 52 /** 凭据 */
53 private String accessToken; 53 private String accessToken;
54 54
55 // 超时(秒) 55 /** 超时(秒) */
56 private Integer expiresIn; 56 private Integer expiresIn;
57 57
58 // 超时时间 58 /** 超时时间 */
59 private Timestamp expiresTime; 59 private Timestamp expiresTime;
60 60
61 // 描述 61 /** 描述 */
62 private String description; 62 private String description;
63 63
64 // 创建者 64 /** 创建者 */
65 private String createBy; 65 private String createBy;
66 66
67 // 创建时间 67 /** 创建时间 */
68 private Timestamp createTime; 68 private Timestamp createTime;
69 69
70 // 更新者 70 /** 更新者 */
71 private String updateBy; 71 private String updateBy;
72 72
73 // 更新时间 73 /** 更新时间 */
74 private Timestamp updateTime; 74 private Timestamp updateTime;
75 75
76 // 来源类型 76 /** 来源类型 */
77 private String sourceType; 77 private String sourceType;
78 78
79 // 来源id 79 /** 来源id */
80 private String sourceId; 80 private String sourceId;
81 81
82 // 来源id 82 /** 来源id */
83 private String sourceDesc; 83 private String sourceDesc;
84 84
85 // 人id 85 /** 人id */
86 private Long personId; 86 private Long personId;
87 87
88 // 来源用户id 88 /** 来源用户id */
89 private Long sourceUser; 89 private Long sourceUser;
90 90
91 // 来源实体:活动-activity/商品-item 91 /** 来源实体:活动-activity/商品-item */
92 private String sourceEntity; 92 private String sourceEntity;
93 93
94 // 授权时间 94 /** 授权时间 */
95 private Timestamp authTime; 95 private Timestamp authTime;
96 96
97 private Integer gender; 97 private Integer gender;
......
1 package com.topdraw.business.module.user.weixin.service.impl; 1 package com.topdraw.business.module.user.weixin.service.impl;
2 2
3 import com.topdraw.aspect.AsyncMqSend;
4 import com.topdraw.business.module.user.weixin.domain.UserWeixin; 3 import com.topdraw.business.module.user.weixin.domain.UserWeixin;
5 import com.topdraw.business.module.user.weixin.domain.UserWeixinBuilder; 4 import com.topdraw.business.module.user.weixin.domain.UserWeixinBuilder;
6 import com.topdraw.utils.ValidationUtil; 5 import com.topdraw.utils.ValidationUtil;
...@@ -24,78 +23,78 @@ import org.springframework.util.Assert; ...@@ -24,78 +23,78 @@ import org.springframework.util.Assert;
24 public class UserWeixinServiceImpl implements UserWeixinService { 23 public class UserWeixinServiceImpl implements UserWeixinService {
25 24
26 @Autowired 25 @Autowired
27 private UserWeixinRepository UserWeixinRepository; 26 private UserWeixinRepository userWeixinRepository;
28 27
29 @Autowired 28 @Autowired
30 private UserWeixinMapper UserWeixinMapper; 29 private UserWeixinMapper userWeixinMapper;
31 30
32 @Override 31 @Override
33 public UserWeixinDTO findById(Long id) { 32 public UserWeixinDTO findById(Long id) {
34 UserWeixin UserWeixin = UserWeixinRepository.findById(id).orElseGet(UserWeixin::new); 33 UserWeixin UserWeixin = this.userWeixinRepository.findById(id).orElseGet(UserWeixin::new);
35 ValidationUtil.isNull(UserWeixin.getId(),"UserWeixin","id",id); 34 ValidationUtil.isNull(UserWeixin.getId(),"UserWeixin","id",id);
36 return UserWeixinMapper.toDto(UserWeixin); 35 return this.userWeixinMapper.toDto(UserWeixin);
37 } 36 }
38 37
39 @Override 38 @Override
40 @Transactional(rollbackFor = Exception.class) 39 @Transactional(rollbackFor = Exception.class)
41 public UserWeixin create(UserWeixin resources) { 40 public UserWeixin create(UserWeixin resources) {
42 UserWeixin build = UserWeixinBuilder.build(resources); 41 UserWeixin build = UserWeixinBuilder.build(resources);
43 UserWeixinRepository.save(build); 42 this.userWeixinRepository.save(build);
44 return resources; 43 return resources;
45 } 44 }
46 45
47 @Override 46 @Override
48 @Transactional(rollbackFor = Exception.class) 47 @Transactional(rollbackFor = Exception.class)
49 public void update(UserWeixin resources) { 48 public void update(UserWeixin resources) {
50 UserWeixin UserWeixin = UserWeixinRepository.findById(resources.getId()).orElseGet(UserWeixin::new); 49 UserWeixin UserWeixin = this.userWeixinRepository.findById(resources.getId()).orElseGet(UserWeixin::new);
51 ValidationUtil.isNull( UserWeixin.getId(),"UserWeixin","id",resources.getId()); 50 ValidationUtil.isNull( UserWeixin.getId(),"UserWeixin","id",resources.getId());
52 UserWeixin.copy(resources); 51 UserWeixin.copy(resources);
53 UserWeixinRepository.save(UserWeixin); 52 this.userWeixinRepository.save(UserWeixin);
54 } 53 }
55 54
56 @Override 55 @Override
57 public void updateTime(UserWeixin resources) { 56 public void updateTime(UserWeixin resources) {
58 UserWeixinRepository.updateTime(resources); 57 this.userWeixinRepository.updateTime(resources);
59 } 58 }
60 59
61 @Override 60 @Override
62 @Transactional(rollbackFor = Exception.class) 61 @Transactional(rollbackFor = Exception.class)
63 public void delete(Long id) { 62 public void delete(Long id) {
64 Assert.notNull(id, "The given id must not be null!"); 63 Assert.notNull(id, "The given id must not be null!");
65 UserWeixin UserWeixin = UserWeixinRepository.findById(id).orElseThrow( 64 UserWeixin UserWeixin = this.userWeixinRepository.findById(id).orElseThrow(
66 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", UserWeixin.class, id), 1)); 65 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", UserWeixin.class, id), 1));
67 UserWeixinRepository.delete(UserWeixin); 66 this.userWeixinRepository.delete(UserWeixin);
68 } 67 }
69 68
70 @Override 69 @Override
71 public UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid) { 70 public UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid) {
72 UserWeixin userWeixin = this.UserWeixinRepository.findFirstByMemberIdAndAppid(memberId, appid).orElseGet(UserWeixin::new); 71 UserWeixin userWeixin = this.userWeixinRepository.findFirstByMemberIdAndAppid(memberId, appid).orElseGet(UserWeixin::new);
73 ValidationUtil.isNull(userWeixin.getId(),"UserWeixin","id",memberId); 72 ValidationUtil.isNull(userWeixin.getId(),"UserWeixin","id",memberId);
74 return UserWeixinMapper.toDto(userWeixin); 73 return this.userWeixinMapper.toDto(userWeixin);
75 } 74 }
76 75
77 @Override 76 @Override
78 public UserWeixinDTO findFirstByUnionIdAndAppIdAndOpenId(String unionId, String appId, String openId) { 77 public UserWeixinDTO findFirstByUnionIdAndAppIdAndOpenId(String unionId, String appId, String openId) {
79 UserWeixin userWeixin = this.UserWeixinRepository.findFirstByUnionidAndAppidAndOpenid(unionId, appId,openId).orElseGet(UserWeixin::new); 78 UserWeixin userWeixin = this.userWeixinRepository.findFirstByUnionidAndAppidAndOpenid(unionId, appId,openId).orElseGet(UserWeixin::new);
80 return UserWeixinMapper.toDto(userWeixin); 79 return this.userWeixinMapper.toDto(userWeixin);
81 } 80 }
82 81
83 @Override 82 @Override
84 public UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId) { 83 public UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId) {
85 UserWeixin userWeixin = this.UserWeixinRepository.findFirstByAppidAndOpenid(appId,openId).orElseGet(UserWeixin::new); 84 UserWeixin userWeixin = this.userWeixinRepository.findFirstByAppidAndOpenid(appId,openId).orElseGet(UserWeixin::new);
86 return UserWeixinMapper.toDto(userWeixin); 85 return this.userWeixinMapper.toDto(userWeixin);
87 } 86 }
88 87
89 @Override 88 @Override
90 public UserWeixinDTO findFirstByUnionId(String unionid) { 89 public UserWeixinDTO findFirstByUnionId(String unionid) {
91 UserWeixin userWeixin = this.UserWeixinRepository.findFirstByUnionid(unionid).orElseGet(UserWeixin::new); 90 UserWeixin userWeixin = this.userWeixinRepository.findFirstByUnionid(unionid).orElseGet(UserWeixin::new);
92 return UserWeixinMapper.toDto(userWeixin); 91 return this.userWeixinMapper.toDto(userWeixin);
93 } 92 }
94 93
95 @Override 94 @Override
96 public UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId) { 95 public UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId) {
97 UserWeixin userWeixin = this.UserWeixinRepository.findFirstByUnionidAndAppid(unionid,appId).orElseGet(UserWeixin::new); 96 UserWeixin userWeixin = this.userWeixinRepository.findFirstByUnionidAndAppid(unionid,appId).orElseGet(UserWeixin::new);
98 return UserWeixinMapper.toDto(userWeixin); 97 return this.userWeixinMapper.toDto(userWeixin);
99 } 98 }
100 99
101 } 100 }
......
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
16 */ 16 */
17 @Api(tags = "CouponOperation管理") 17 @Api(tags = "CouponOperation管理")
18 @RestController 18 @RestController
19 @RequestMapping("/api/CouponOperation") 19 @RequestMapping("/ucEngine/api/couponOperation")
20 public class CouponOperationController { 20 public class CouponOperationController {
21 21
22 @Autowired 22 @Autowired
......
...@@ -23,7 +23,7 @@ import java.util.List; ...@@ -23,7 +23,7 @@ import java.util.List;
23 */ 23 */
24 @Api(tags = "ExpOperation管理") 24 @Api(tags = "ExpOperation管理")
25 @RestController 25 @RestController
26 @RequestMapping("/api/ExpOperation") 26 @RequestMapping("/ucEngine/api/expOperation")
27 public class ExpOperationController { 27 public class ExpOperationController {
28 28
29 @Autowired 29 @Autowired
......
...@@ -3,9 +3,6 @@ package com.topdraw.business.process.rest; ...@@ -3,9 +3,6 @@ package com.topdraw.business.process.rest;
3 import com.topdraw.annotation.AnonymousAccess; 3 import com.topdraw.annotation.AnonymousAccess;
4 import com.topdraw.business.module.member.service.MemberService; 4 import com.topdraw.business.module.member.service.MemberService;
5 import com.topdraw.business.module.member.service.dto.MemberDTO; 5 import com.topdraw.business.module.member.service.dto.MemberDTO;
6 import com.topdraw.business.module.points.available.service.PointsAvailableService;
7 import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria;
8 import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryType;
9 import com.topdraw.business.module.points.detail.service.PointsDetailService; 6 import com.topdraw.business.module.points.detail.service.PointsDetailService;
10 import com.topdraw.business.module.points.detail.service.dto.PointsDetailQueryCriteria; 7 import com.topdraw.business.module.points.detail.service.dto.PointsDetailQueryCriteria;
11 import com.topdraw.business.module.user.iptv.service.UserTvService; 8 import com.topdraw.business.module.user.iptv.service.UserTvService;
...@@ -18,11 +15,8 @@ import com.topdraw.business.process.service.dto.CustomPointsResult; ...@@ -18,11 +15,8 @@ import com.topdraw.business.process.service.dto.CustomPointsResult;
18 import com.topdraw.business.process.service.PointsOperationService; 15 import com.topdraw.business.process.service.PointsOperationService;
19 import com.topdraw.common.ResultInfo; 16 import com.topdraw.common.ResultInfo;
20 import com.topdraw.config.LocalConstants; 17 import com.topdraw.config.LocalConstants;
21 import com.topdraw.util.TimestampUtil;
22 import io.swagger.annotations.Api; 18 import io.swagger.annotations.Api;
23 import io.swagger.annotations.ApiOperation; 19 import io.swagger.annotations.ApiOperation;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
27 import org.springframework.data.domain.Pageable; 21 import org.springframework.data.domain.Pageable;
28 import org.springframework.util.Assert; 22 import org.springframework.util.Assert;
...@@ -41,20 +35,16 @@ import java.util.Objects; ...@@ -41,20 +35,16 @@ import java.util.Objects;
41 @RequestMapping("/ucEngine/api/pointsOperation") 35 @RequestMapping("/ucEngine/api/pointsOperation")
42 public class PointsOperationController { 36 public class PointsOperationController {
43 37
44 private static final Logger LOG = LoggerFactory.getLogger(PointsOperationController.class);
45
46 @Autowired
47 PointsOperationService pointsOperationService;
48 @Autowired 38 @Autowired
49 PointsDetailService pointsDetailService; 39 private UserTvService userTvService;
50 @Autowired 40 @Autowired
51 PointsAvailableService pointsAvailableService; 41 private MemberService memberService;
52 @Autowired 42 @Autowired
53 UserTvService userTvService; 43 private UserWeixinService userWeixinService;
54 @Autowired 44 @Autowired
55 UserWeixinService userWeixinService; 45 private PointsDetailService pointsDetailService;
56 @Autowired 46 @Autowired
57 MemberService memberService; 47 private PointsOperationService pointsOperationService;
58 48
59 49
60 @GetMapping(value = "/pagePointsDetails") 50 @GetMapping(value = "/pagePointsDetails")
...@@ -64,18 +54,6 @@ public class PointsOperationController { ...@@ -64,18 +54,6 @@ public class PointsOperationController {
64 return ResultInfo.successPage(pointsDetailService.queryAll(criteria,pageable)); 54 return ResultInfo.successPage(pointsDetailService.queryAll(criteria,pageable));
65 } 55 }
66 56
67 @GetMapping(value = "/pageAvailablePoints")
68 @ApiOperation("查询PointsAvailable")
69 @AnonymousAccess
70 public ResultInfo pageAvailablePoints(PointsAvailableQueryCriteria criteria, Pageable pageable) {
71 PointsAvailableQueryType queryType = criteria.getQueryType();
72 // 可用
73 if (queryType == PointsAvailableQueryType.AVAILABLE_ONLY) {
74 criteria.setExpireTime(TimestampUtil.now());
75 }
76 return ResultInfo.successPage(pointsAvailableService.queryAll(criteria,pageable));
77 }
78
79 @GetMapping(value = "/cleanInvalidPointsAndCalculateCurrentPoints/{id}") 57 @GetMapping(value = "/cleanInvalidPointsAndCalculateCurrentPoints/{id}")
80 @ApiOperation("清除过期积分并计算总积分,供客户端会员查询积分时调用") 58 @ApiOperation("清除过期积分并计算总积分,供客户端会员查询积分时调用")
81 @AnonymousAccess 59 @AnonymousAccess
...@@ -119,7 +97,6 @@ public class PointsOperationController { ...@@ -119,7 +97,6 @@ public class PointsOperationController {
119 Long orderId = tempIptvUser.getOrderId(); 97 Long orderId = tempIptvUser.getOrderId();
120 Integer deviceType = tempIptvUser.getDeviceType(); 98 Integer deviceType = tempIptvUser.getDeviceType();
121 99
122
123 TempPoints tempPoints = new TempPoints(); 100 TempPoints tempPoints = new TempPoints();
124 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 101 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
125 if (Objects.nonNull(userTvDTO)) { 102 if (Objects.nonNull(userTvDTO)) {
......
...@@ -23,7 +23,7 @@ import java.util.List; ...@@ -23,7 +23,7 @@ import java.util.List;
23 */ 23 */
24 @Api(tags = "Rights管理") 24 @Api(tags = "Rights管理")
25 @RestController 25 @RestController
26 @RequestMapping("/api/RightsOperation") 26 @RequestMapping("/ucEngine/api/rightsOperation")
27 public class RightsOperationController { 27 public class RightsOperationController {
28 28
29 @Autowired 29 @Autowired
......
...@@ -27,6 +27,10 @@ public interface ExpOperationService { ...@@ -27,6 +27,10 @@ public interface ExpOperationService {
27 */ 27 */
28 void grantExpByManual(Long memberId,Long userId ,List<TempExp> tempExpList); 28 void grantExpByManual(Long memberId,Long userId ,List<TempExp> tempExpList);
29 29
30 /**
31 *
32 * @param tempExpList
33 */
30 void grantExpByManual(List<TempExp> tempExpList); 34 void grantExpByManual(List<TempExp> tempExpList);
31 35
32 } 36 }
......
...@@ -16,6 +16,11 @@ public interface TaskOperationService { ...@@ -16,6 +16,11 @@ public interface TaskOperationService {
16 */ 16 */
17 ResultInfo dealTask(String content); 17 ResultInfo dealTask(String content);
18 18
19 19 /**
20 *
21 * @param platformAccount
22 * @param points
23 * @return
24 */
20 boolean createPoint2ChongQing(String platformAccount, Long points); 25 boolean createPoint2ChongQing(String platformAccount, Long points);
21 } 26 }
......
...@@ -15,7 +15,6 @@ import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; ...@@ -15,7 +15,6 @@ import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO;
15 import com.topdraw.business.module.task.progress.domain.TrTaskProgress; 15 import com.topdraw.business.module.task.progress.domain.TrTaskProgress;
16 import com.topdraw.business.module.task.progress.service.TrTaskProgressService; 16 import com.topdraw.business.module.task.progress.service.TrTaskProgressService;
17 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; 17 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO;
18 import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressQueryCriteria;
19 import com.topdraw.business.module.user.iptv.domain.UserTv; 18 import com.topdraw.business.module.user.iptv.domain.UserTv;
20 import com.topdraw.business.module.user.iptv.service.UserTvService; 19 import com.topdraw.business.module.user.iptv.service.UserTvService;
21 import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; 20 import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
...@@ -671,14 +670,10 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -671,14 +670,10 @@ public class TaskOperationServiceImpl implements TaskOperationService {
671 * @return boolean false:失败 true:成功 670 * @return boolean false:失败 true:成功
672 */ 671 */
673 private boolean checkAndRefreshTaskCompletion(Long memberId , List<Task> taskStream) { 672 private boolean checkAndRefreshTaskCompletion(Long memberId , List<Task> taskStream) {
674 TrTaskProgressQueryCriteria trTaskProgressQueryCriteria = new TrTaskProgressQueryCriteria();
675 trTaskProgressQueryCriteria.setMemberId(memberId);
676 String time1 = LocalDateTimeUtil.todayStart(); 673 String time1 = LocalDateTimeUtil.todayStart();
677
678 for (Task task : taskStream) { 674 for (Task task : taskStream) {
679 675
680 Long taskId = task.getId(); 676 Long taskId = task.getId();
681 trTaskProgressQueryCriteria.setTaskId(taskId);
682 // 任务完成记录 677 // 任务完成记录
683 List<TrTaskProgressDTO> trTaskProgressDTOS = 678 List<TrTaskProgressDTO> trTaskProgressDTOS =
684 this.trTaskProgressService.findByMemberIdAndTaskIdAndCompletionTime(memberId,taskId,time1); 679 this.trTaskProgressService.findByMemberIdAndTaskIdAndCompletionTime(memberId,taskId,time1);
...@@ -772,6 +767,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -772,6 +767,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
772 767
773 // 更新任务完成情况 768 // 更新任务完成情况
774 this.doRefreshTrTaskProcess(trTaskProgress); 769 this.doRefreshTrTaskProcess(trTaskProgress);
770
775 // 行为量达标 771 // 行为量达标
776 if (currentActionAmount.compareTo(actionAmount) == 0) { 772 if (currentActionAmount.compareTo(actionAmount) == 0) {
777 return true; 773 return true;
......
...@@ -16,6 +16,13 @@ public interface GlobeExceptionMsg { ...@@ -16,6 +16,13 @@ public interface GlobeExceptionMsg {
16 String OPERATION_FORBID = "operation forbid"; 16 String OPERATION_FORBID = "operation forbid";
17 String ENTITY_ALREADY_EXISTS = "entity already exists"; 17 String ENTITY_ALREADY_EXISTS = "entity already exists";
18 18
19
20 /**************************************************************/
21 /** 优惠券 */
22 String COUPON_ID_IS_NULL = "coupon id is null";
23 String COUPON_CODE_IS_NULL = "coupon code is null";
24
25
19 /**************************************************************/ 26 /**************************************************************/
20 27
21 /** 会员管理 */ 28 /** 会员管理 */
......
1 package com.topdraw.util; 1 package com.topdraw.util;
2 2
3 import org.apache.commons.lang3.StringUtils;
3 import org.slf4j.Logger; 4 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory; 5 import org.slf4j.LoggerFactory;
5 6
...@@ -149,6 +150,14 @@ public class IdWorker { ...@@ -149,6 +150,14 @@ public class IdWorker {
149 return idWorker.nextId(); 150 return idWorker.nextId();
150 } 151 }
151 152
153 public static String generatorCode(String prefix){
154 IdWorker idWorker = new IdWorker();
155 if (StringUtils.isNotBlank(prefix)) {
156 return prefix+"_"+String.valueOf(idWorker.nextId());
157 }
158 return String.valueOf(idWorker.nextId());
159 }
160
152 public static void main(String[] args) { 161 public static void main(String[] args) {
153 IdWorker idWorker = new IdWorker(); 162 IdWorker idWorker = new IdWorker();
154 System.out.println(idWorker.nextId()); 163 System.out.println(idWorker.nextId());
......