1.接口优化,删除不必要的接口
Showing
38 changed files
with
0 additions
and
979 deletions
... | @@ -58,14 +58,12 @@ public class CouponHistoryServiceImpl implements CouponHistoryService { | ... | @@ -58,14 +58,12 @@ public class CouponHistoryServiceImpl implements CouponHistoryService { |
58 | 58 | ||
59 | @Override | 59 | @Override |
60 | @Transactional(rollbackFor = Exception.class) | 60 | @Transactional(rollbackFor = Exception.class) |
61 | @AsyncMqSend() | ||
62 | public void create(CouponHistory resources) { | 61 | public void create(CouponHistory resources) { |
63 | CouponHistoryRepository.save(resources); | 62 | CouponHistoryRepository.save(resources); |
64 | } | 63 | } |
65 | 64 | ||
66 | @Override | 65 | @Override |
67 | @Transactional(rollbackFor = Exception.class) | 66 | @Transactional(rollbackFor = Exception.class) |
68 | @AsyncMqSend() | ||
69 | public void update(CouponHistory resources) { | 67 | public void update(CouponHistory resources) { |
70 | CouponHistory CouponHistory = CouponHistoryRepository.findById(resources.getId()).orElseGet(CouponHistory::new); | 68 | CouponHistory CouponHistory = CouponHistoryRepository.findById(resources.getId()).orElseGet(CouponHistory::new); |
71 | ValidationUtil.isNull( CouponHistory.getId(),"CouponHistory","id",resources.getId()); | 69 | ValidationUtil.isNull( CouponHistory.getId(),"CouponHistory","id",resources.getId()); | ... | ... |
... | @@ -3,9 +3,7 @@ package com.topdraw.business.module.coupon.rest; | ... | @@ -3,9 +3,7 @@ package com.topdraw.business.module.coupon.rest; |
3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
4 | import com.topdraw.business.module.coupon.domain.Coupon; | 4 | import com.topdraw.business.module.coupon.domain.Coupon; |
5 | import com.topdraw.business.module.coupon.service.CouponService; | 5 | import com.topdraw.business.module.coupon.service.CouponService; |
6 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; | ||
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.*; |
... | @@ -22,18 +20,6 @@ public class CouponController { | ... | @@ -22,18 +20,6 @@ public class CouponController { |
22 | @Autowired | 20 | @Autowired |
23 | private CouponService CouponService; | 21 | private CouponService CouponService; |
24 | 22 | ||
25 | @GetMapping | ||
26 | @ApiOperation("查询Coupon") | ||
27 | public ResultInfo getCoupons(CouponQueryCriteria criteria, Pageable pageable) { | ||
28 | return ResultInfo.successPage(CouponService.queryAll(criteria,pageable)); | ||
29 | } | ||
30 | |||
31 | @GetMapping(value = "/all") | ||
32 | @ApiOperation("查询所有Coupon") | ||
33 | public ResultInfo getCoupons(CouponQueryCriteria criteria) { | ||
34 | return ResultInfo.success(CouponService.queryAll(criteria)); | ||
35 | } | ||
36 | |||
37 | @PostMapping(value = "/create") | 23 | @PostMapping(value = "/create") |
38 | @ApiOperation("新增Coupon") | 24 | @ApiOperation("新增Coupon") |
39 | public ResultInfo create(@Validated @RequestBody Coupon resources) { | 25 | public ResultInfo create(@Validated @RequestBody Coupon resources) { | ... | ... |
... | @@ -12,22 +12,6 @@ import java.util.List; | ... | @@ -12,22 +12,6 @@ import java.util.List; |
12 | * @date 2021-10-22 | 12 | * @date 2021-10-22 |
13 | */ | 13 | */ |
14 | public interface CouponService { | 14 | public interface CouponService { |
15 | |||
16 | /** | ||
17 | * 查询数据分页 | ||
18 | * @param criteria 条件参数 | ||
19 | * @param pageable 分页参数 | ||
20 | * @return Map<String,Object> | ||
21 | */ | ||
22 | Map<String,Object> queryAll(CouponQueryCriteria criteria, Pageable pageable); | ||
23 | |||
24 | /** | ||
25 | * 查询所有数据不分页 | ||
26 | * @param criteria 条件参数 | ||
27 | * @return List<CouponDTO> | ||
28 | */ | ||
29 | List<CouponDTO> queryAll(CouponQueryCriteria criteria); | ||
30 | |||
31 | /** | 15 | /** |
32 | * 根据ID查询 | 16 | * 根据ID查询 |
33 | * @param id ID | 17 | * @param id ID | ... | ... |
1 | package com.topdraw.business.module.coupon.service.impl; | 1 | package com.topdraw.business.module.coupon.service.impl; |
2 | 2 | ||
3 | import com.topdraw.aspect.AsyncMqSend; | ||
4 | import com.topdraw.business.module.coupon.domain.Coupon; | 3 | import com.topdraw.business.module.coupon.domain.Coupon; |
5 | import com.topdraw.util.RedissonUtil; | 4 | import com.topdraw.util.RedissonUtil; |
6 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
7 | import com.topdraw.business.module.coupon.repository.CouponRepository; | 6 | import com.topdraw.business.module.coupon.repository.CouponRepository; |
8 | import com.topdraw.business.module.coupon.service.CouponService; | 7 | import com.topdraw.business.module.coupon.service.CouponService; |
9 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; | 8 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
10 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; | ||
11 | import com.topdraw.business.module.coupon.service.mapper.CouponMapper; | 9 | import com.topdraw.business.module.coupon.service.mapper.CouponMapper; |
12 | import org.redisson.api.RLock; | 10 | import org.redisson.api.RLock; |
13 | import org.redisson.api.RedissonClient; | 11 | import org.redisson.api.RedissonClient; |
... | @@ -16,15 +14,9 @@ import org.springframework.stereotype.Service; | ... | @@ -16,15 +14,9 @@ import org.springframework.stereotype.Service; |
16 | import org.springframework.transaction.annotation.Propagation; | 14 | import org.springframework.transaction.annotation.Propagation; |
17 | import org.springframework.transaction.annotation.Transactional; | 15 | import org.springframework.transaction.annotation.Transactional; |
18 | import org.springframework.dao.EmptyResultDataAccessException; | 16 | import org.springframework.dao.EmptyResultDataAccessException; |
19 | import org.springframework.data.domain.Page; | ||
20 | import org.springframework.data.domain.Pageable; | ||
21 | import org.springframework.util.Assert; | 17 | import org.springframework.util.Assert; |
22 | import com.topdraw.utils.PageUtil; | ||
23 | import com.topdraw.utils.QueryHelp; | ||
24 | import com.topdraw.utils.StringUtils; | 18 | import com.topdraw.utils.StringUtils; |
25 | 19 | ||
26 | import java.util.List; | ||
27 | import java.util.Map; | ||
28 | 20 | ||
29 | /** | 21 | /** |
30 | * @author XiangHan | 22 | * @author XiangHan |
... | @@ -44,17 +36,6 @@ public class CouponServiceImpl implements CouponService { | ... | @@ -44,17 +36,6 @@ public class CouponServiceImpl implements CouponService { |
44 | private RedissonClient redissonClient; | 36 | private RedissonClient redissonClient; |
45 | 37 | ||
46 | @Override | 38 | @Override |
47 | public Map<String, Object> queryAll(CouponQueryCriteria criteria, Pageable pageable) { | ||
48 | Page<Coupon> page = CouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
49 | return PageUtil.toPage(page.map(CouponMapper::toDto)); | ||
50 | } | ||
51 | |||
52 | @Override | ||
53 | public List<CouponDTO> queryAll(CouponQueryCriteria criteria) { | ||
54 | return CouponMapper.toDto(CouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
55 | } | ||
56 | |||
57 | @Override | ||
58 | public CouponDTO findById(Long id) { | 39 | public CouponDTO findById(Long id) { |
59 | Coupon Coupon = CouponRepository.findById(id).orElseGet(Coupon::new); | 40 | Coupon Coupon = CouponRepository.findById(id).orElseGet(Coupon::new); |
60 | ValidationUtil.isNull(Coupon.getId(),"Coupon","id",id); | 41 | ValidationUtil.isNull(Coupon.getId(),"Coupon","id",id); |
... | @@ -63,14 +44,12 @@ public class CouponServiceImpl implements CouponService { | ... | @@ -63,14 +44,12 @@ public class CouponServiceImpl implements CouponService { |
63 | 44 | ||
64 | @Override | 45 | @Override |
65 | @Transactional(rollbackFor = Exception.class) | 46 | @Transactional(rollbackFor = Exception.class) |
66 | @AsyncMqSend() | ||
67 | public void create(Coupon resources) { | 47 | public void create(Coupon resources) { |
68 | CouponRepository.save(resources); | 48 | CouponRepository.save(resources); |
69 | } | 49 | } |
70 | 50 | ||
71 | @Override | 51 | @Override |
72 | @Transactional(rollbackFor = Exception.class) | 52 | @Transactional(rollbackFor = Exception.class) |
73 | @AsyncMqSend() | ||
74 | public void update(Coupon resources) { | 53 | public void update(Coupon resources) { |
75 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); | 54 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); |
76 | try { | 55 | try { |
... | @@ -89,7 +68,6 @@ public class CouponServiceImpl implements CouponService { | ... | @@ -89,7 +68,6 @@ public class CouponServiceImpl implements CouponService { |
89 | 68 | ||
90 | @Override | 69 | @Override |
91 | @Transactional(rollbackFor = Exception.class) | 70 | @Transactional(rollbackFor = Exception.class) |
92 | @AsyncMqSend() | ||
93 | public void delete(Long id) { | 71 | public void delete(Long id) { |
94 | Assert.notNull(id, "The given id must not be null!"); | 72 | Assert.notNull(id, "The given id must not be null!"); |
95 | Coupon Coupon = CouponRepository.findById(id).orElseThrow( | 73 | Coupon Coupon = CouponRepository.findById(id).orElseThrow( |
... | @@ -97,7 +75,6 @@ public class CouponServiceImpl implements CouponService { | ... | @@ -97,7 +75,6 @@ public class CouponServiceImpl implements CouponService { |
97 | CouponRepository.delete(Coupon); | 75 | CouponRepository.delete(Coupon); |
98 | } | 76 | } |
99 | 77 | ||
100 | |||
101 | @Override | 78 | @Override |
102 | public CouponDTO getByCode(String code) { | 79 | public CouponDTO getByCode(String code) { |
103 | return StringUtils.isNotEmpty(code) ? CouponMapper.toDto(CouponRepository.findFirstByCode(code).orElseGet(Coupon::new)) | 80 | return StringUtils.isNotEmpty(code) ? CouponMapper.toDto(CouponRepository.findFirstByCode(code).orElseGet(Coupon::new)) | ... | ... |
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.aspect.AsyncMqSend; | ||
4 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; | 3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
5 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
6 | import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository; | 5 | import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository; |
... | @@ -62,14 +61,12 @@ public class ExpDetailServiceImpl implements ExpDetailService { | ... | @@ -62,14 +61,12 @@ public class ExpDetailServiceImpl implements ExpDetailService { |
62 | 61 | ||
63 | @Override | 62 | @Override |
64 | @Transactional(rollbackFor = Exception.class) | 63 | @Transactional(rollbackFor = Exception.class) |
65 | @AsyncMqSend() | ||
66 | public void create(ExpDetail resources) { | 64 | public void create(ExpDetail resources) { |
67 | ExpDetailRepository.save(resources); | 65 | ExpDetailRepository.save(resources); |
68 | } | 66 | } |
69 | 67 | ||
70 | @Override | 68 | @Override |
71 | @Transactional(rollbackFor = Exception.class) | 69 | @Transactional(rollbackFor = Exception.class) |
72 | @AsyncMqSend() | ||
73 | public void update(ExpDetail resources) { | 70 | public void update(ExpDetail resources) { |
74 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); | 71 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); |
75 | try { | 72 | try { |
... | @@ -87,7 +84,6 @@ public class ExpDetailServiceImpl implements ExpDetailService { | ... | @@ -87,7 +84,6 @@ public class ExpDetailServiceImpl implements ExpDetailService { |
87 | 84 | ||
88 | @Override | 85 | @Override |
89 | @Transactional(rollbackFor = Exception.class) | 86 | @Transactional(rollbackFor = Exception.class) |
90 | @AsyncMqSend() | ||
91 | public void delete(Long id) { | 87 | public void delete(Long id) { |
92 | Assert.notNull(id, "The given id must not be null!"); | 88 | Assert.notNull(id, "The given id must not be null!"); |
93 | ExpDetail ExpDetail = ExpDetailRepository.findById(id).orElseThrow( | 89 | ExpDetail ExpDetail = ExpDetailRepository.findById(id).orElseThrow( |
... | @@ -95,7 +91,6 @@ public class ExpDetailServiceImpl implements ExpDetailService { | ... | @@ -95,7 +91,6 @@ public class ExpDetailServiceImpl implements ExpDetailService { |
95 | ExpDetailRepository.delete(ExpDetail); | 91 | ExpDetailRepository.delete(ExpDetail); |
96 | } | 92 | } |
97 | 93 | ||
98 | |||
99 | @Override | 94 | @Override |
100 | public ExpDetailDTO getByCode(String code) { | 95 | public ExpDetailDTO getByCode(String code) { |
101 | return StringUtils.isNotEmpty(code) ? ExpDetailMapper.toDto(ExpDetailRepository.findFirstByCode(code).orElseGet(ExpDetail::new)) | 96 | return StringUtils.isNotEmpty(code) ? ExpDetailMapper.toDto(ExpDetailRepository.findFirstByCode(code).orElseGet(ExpDetail::new)) | ... | ... |
1 | package com.topdraw.business.module.exp.history.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.exp.history.service.ExpHistoryService; | ||
5 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.data.domain.Pageable; | ||
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 = "ExpHistory管理") | ||
16 | @RestController | ||
17 | @RequestMapping("/api/ExpHistory") | ||
18 | public class ExpHistoryController { | ||
19 | |||
20 | @Autowired | ||
21 | private ExpHistoryService ExpHistoryService; | ||
22 | |||
23 | @GetMapping | ||
24 | @ApiOperation("查询ExpHistory") | ||
25 | public ResultInfo getExpHistorys(ExpHistoryQueryCriteria criteria, Pageable pageable) { | ||
26 | return ResultInfo.successPage(ExpHistoryService.queryAll(criteria,pageable)); | ||
27 | } | ||
28 | |||
29 | @GetMapping(value = "/all") | ||
30 | @ApiOperation("查询所有ExpHistory") | ||
31 | public ResultInfo getExpHistorys(ExpHistoryQueryCriteria criteria) { | ||
32 | return ResultInfo.success(ExpHistoryService.queryAll(criteria)); | ||
33 | } | ||
34 | |||
35 | @GetMapping(value = "/getByCode/{code}") | ||
36 | @ApiOperation(value = "根据标识查询") | ||
37 | public ResultInfo getByCode(@PathVariable String code) { | ||
38 | return ResultInfo.success(ExpHistoryService.getByCode(code)); | ||
39 | } | ||
40 | } |
... | @@ -12,22 +12,6 @@ import java.util.List; | ... | @@ -12,22 +12,6 @@ import java.util.List; |
12 | * @date 2021-10-22 | 12 | * @date 2021-10-22 |
13 | */ | 13 | */ |
14 | public interface ExpHistoryService { | 14 | public interface ExpHistoryService { |
15 | |||
16 | /** | ||
17 | * 查询数据分页 | ||
18 | * @param criteria 条件参数 | ||
19 | * @param pageable 分页参数 | ||
20 | * @return Map<String,Object> | ||
21 | */ | ||
22 | Map<String,Object> queryAll(ExpHistoryQueryCriteria criteria, Pageable pageable); | ||
23 | |||
24 | /** | ||
25 | * 查询所有数据不分页 | ||
26 | * @param criteria 条件参数 | ||
27 | * @return List<ExpHistoryDTO> | ||
28 | */ | ||
29 | List<ExpHistoryDTO> queryAll(ExpHistoryQueryCriteria criteria); | ||
30 | |||
31 | /** | 15 | /** |
32 | * 根据ID查询 | 16 | * 根据ID查询 |
33 | * @param id ID | 17 | * @param id ID | ... | ... |
1 | package com.topdraw.business.module.exp.history.service.impl; | 1 | package com.topdraw.business.module.exp.history.service.impl; |
2 | 2 | ||
3 | import com.topdraw.aspect.AsyncMqSend; | ||
4 | import com.topdraw.business.module.exp.history.domain.ExpHistory; | 3 | import com.topdraw.business.module.exp.history.domain.ExpHistory; |
5 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
6 | import com.topdraw.business.module.exp.history.repository.ExpHistoryRepository; | 5 | import com.topdraw.business.module.exp.history.repository.ExpHistoryRepository; |
7 | import com.topdraw.business.module.exp.history.service.ExpHistoryService; | 6 | import com.topdraw.business.module.exp.history.service.ExpHistoryService; |
8 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; | 7 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; |
9 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; | ||
10 | import com.topdraw.business.module.exp.history.service.mapper.ExpHistoryMapper; | 8 | import com.topdraw.business.module.exp.history.service.mapper.ExpHistoryMapper; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
13 | import org.springframework.transaction.annotation.Propagation; | 11 | import org.springframework.transaction.annotation.Propagation; |
14 | import org.springframework.transaction.annotation.Transactional; | 12 | import org.springframework.transaction.annotation.Transactional; |
15 | import org.springframework.dao.EmptyResultDataAccessException; | 13 | import org.springframework.dao.EmptyResultDataAccessException; |
16 | import org.springframework.data.domain.Page; | ||
17 | import org.springframework.data.domain.Pageable; | ||
18 | import org.springframework.util.Assert; | 14 | import org.springframework.util.Assert; |
19 | import com.topdraw.utils.PageUtil; | ||
20 | import com.topdraw.utils.QueryHelp; | ||
21 | import com.topdraw.utils.StringUtils; | 15 | import com.topdraw.utils.StringUtils; |
22 | 16 | ||
23 | import java.util.List; | ||
24 | import java.util.Map; | ||
25 | 17 | ||
26 | /** | 18 | /** |
27 | * @author XiangHan | 19 | * @author XiangHan |
... | @@ -38,17 +30,6 @@ public class ExpHistoryServiceImpl implements ExpHistoryService { | ... | @@ -38,17 +30,6 @@ public class ExpHistoryServiceImpl implements ExpHistoryService { |
38 | private ExpHistoryMapper ExpHistoryMapper; | 30 | private ExpHistoryMapper ExpHistoryMapper; |
39 | 31 | ||
40 | @Override | 32 | @Override |
41 | public Map<String, Object> queryAll(ExpHistoryQueryCriteria criteria, Pageable pageable) { | ||
42 | Page<ExpHistory> page = ExpHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
43 | return PageUtil.toPage(page.map(ExpHistoryMapper::toDto)); | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | public List<ExpHistoryDTO> queryAll(ExpHistoryQueryCriteria criteria) { | ||
48 | return ExpHistoryMapper.toDto(ExpHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
49 | } | ||
50 | |||
51 | @Override | ||
52 | public ExpHistoryDTO findById(Long id) { | 33 | public ExpHistoryDTO findById(Long id) { |
53 | ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseGet(ExpHistory::new); | 34 | ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseGet(ExpHistory::new); |
54 | ValidationUtil.isNull(ExpHistory.getId(),"ExpHistory","id",id); | 35 | ValidationUtil.isNull(ExpHistory.getId(),"ExpHistory","id",id); |
... | @@ -57,14 +38,12 @@ public class ExpHistoryServiceImpl implements ExpHistoryService { | ... | @@ -57,14 +38,12 @@ public class ExpHistoryServiceImpl implements ExpHistoryService { |
57 | 38 | ||
58 | @Override | 39 | @Override |
59 | @Transactional(rollbackFor = Exception.class) | 40 | @Transactional(rollbackFor = Exception.class) |
60 | @AsyncMqSend() | ||
61 | public void create(ExpHistory resources) { | 41 | public void create(ExpHistory resources) { |
62 | ExpHistoryRepository.save(resources); | 42 | ExpHistoryRepository.save(resources); |
63 | } | 43 | } |
64 | 44 | ||
65 | @Override | 45 | @Override |
66 | @Transactional(rollbackFor = Exception.class) | 46 | @Transactional(rollbackFor = Exception.class) |
67 | @AsyncMqSend() | ||
68 | public void update(ExpHistory resources) { | 47 | public void update(ExpHistory resources) { |
69 | ExpHistory ExpHistory = ExpHistoryRepository.findById(resources.getId()).orElseGet(ExpHistory::new); | 48 | ExpHistory ExpHistory = ExpHistoryRepository.findById(resources.getId()).orElseGet(ExpHistory::new); |
70 | ValidationUtil.isNull( ExpHistory.getId(),"ExpHistory","id",resources.getId()); | 49 | ValidationUtil.isNull( ExpHistory.getId(),"ExpHistory","id",resources.getId()); |
... | @@ -74,7 +53,6 @@ public class ExpHistoryServiceImpl implements ExpHistoryService { | ... | @@ -74,7 +53,6 @@ public class ExpHistoryServiceImpl implements ExpHistoryService { |
74 | 53 | ||
75 | @Override | 54 | @Override |
76 | @Transactional(rollbackFor = Exception.class) | 55 | @Transactional(rollbackFor = Exception.class) |
77 | @AsyncMqSend() | ||
78 | public void delete(Long id) { | 56 | public void delete(Long id) { |
79 | Assert.notNull(id, "The given id must not be null!"); | 57 | Assert.notNull(id, "The given id must not be null!"); |
80 | ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseThrow( | 58 | ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseThrow( |
... | @@ -82,7 +60,6 @@ public class ExpHistoryServiceImpl implements ExpHistoryService { | ... | @@ -82,7 +60,6 @@ public class ExpHistoryServiceImpl implements ExpHistoryService { |
82 | ExpHistoryRepository.delete(ExpHistory); | 60 | ExpHistoryRepository.delete(ExpHistory); |
83 | } | 61 | } |
84 | 62 | ||
85 | |||
86 | @Override | 63 | @Override |
87 | public ExpHistoryDTO getByCode(String code) { | 64 | public ExpHistoryDTO getByCode(String code) { |
88 | return StringUtils.isNotEmpty(code) ? ExpHistoryMapper.toDto(ExpHistoryRepository.findFirstByCode(code).orElseGet(ExpHistory::new)) | 65 | return StringUtils.isNotEmpty(code) ? ExpHistoryMapper.toDto(ExpHistoryRepository.findFirstByCode(code).orElseGet(ExpHistory::new)) | ... | ... |
... | @@ -50,7 +50,6 @@ public class MemberAddressServiceImpl implements MemberAddressService { | ... | @@ -50,7 +50,6 @@ public class MemberAddressServiceImpl implements MemberAddressService { |
50 | 50 | ||
51 | @Override | 51 | @Override |
52 | @Transactional(rollbackFor = Exception.class) | 52 | @Transactional(rollbackFor = Exception.class) |
53 | @AsyncMqSend() | ||
54 | public void create(MemberAddress resources) { | 53 | public void create(MemberAddress resources) { |
55 | log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources); | 54 | log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources); |
56 | MemberDTO memberDTO = this.checkMember(resources); | 55 | MemberDTO memberDTO = this.checkMember(resources); |
... | @@ -61,7 +60,6 @@ public class MemberAddressServiceImpl implements MemberAddressService { | ... | @@ -61,7 +60,6 @@ public class MemberAddressServiceImpl implements MemberAddressService { |
61 | 60 | ||
62 | @Override | 61 | @Override |
63 | @Transactional(rollbackFor = Exception.class) | 62 | @Transactional(rollbackFor = Exception.class) |
64 | @AsyncMqSend() | ||
65 | public void update(MemberAddress resources) { | 63 | public void update(MemberAddress resources) { |
66 | log.info("MemberAddressServiceImpl ==>> update ==>> param ==>> [{}]",resources); | 64 | log.info("MemberAddressServiceImpl ==>> update ==>> param ==>> [{}]",resources); |
67 | Assert.notNull(resources.getId(),"id can't be null"); | 65 | Assert.notNull(resources.getId(),"id can't be null"); |
... | @@ -87,7 +85,6 @@ public class MemberAddressServiceImpl implements MemberAddressService { | ... | @@ -87,7 +85,6 @@ public class MemberAddressServiceImpl implements MemberAddressService { |
87 | 85 | ||
88 | @Override | 86 | @Override |
89 | @Transactional(rollbackFor = Exception.class) | 87 | @Transactional(rollbackFor = Exception.class) |
90 | @AsyncMqSend() | ||
91 | public void delete(Long id) { | 88 | public void delete(Long id) { |
92 | Assert.notNull(id, "The given id must not be null!"); | 89 | Assert.notNull(id, "The given id must not be null!"); |
93 | MemberAddress MemberAddress = this.memberAddressRepository.findById(id).orElseThrow( | 90 | MemberAddress MemberAddress = this.memberAddressRepository.findById(id).orElseThrow( | ... | ... |
... | @@ -70,7 +70,6 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -70,7 +70,6 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
70 | 70 | ||
71 | @Override | 71 | @Override |
72 | @Transactional(rollbackFor = Exception.class) | 72 | @Transactional(rollbackFor = Exception.class) |
73 | @AsyncMqSend() | ||
74 | public MemberProfile create(MemberProfile resources) { | 73 | public MemberProfile create(MemberProfile resources) { |
75 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | 74 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); |
76 | 75 | ||
... | @@ -111,7 +110,6 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -111,7 +110,6 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
111 | 110 | ||
112 | @Override | 111 | @Override |
113 | @Transactional(rollbackFor = Exception.class) | 112 | @Transactional(rollbackFor = Exception.class) |
114 | @AsyncMqSend() | ||
115 | public void update(MemberProfile resources) { | 113 | public void update(MemberProfile resources) { |
116 | 114 | ||
117 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | 115 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); |
... | @@ -143,7 +141,6 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -143,7 +141,6 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
143 | 141 | ||
144 | @Override | 142 | @Override |
145 | @Transactional(rollbackFor = Exception.class) | 143 | @Transactional(rollbackFor = Exception.class) |
146 | @AsyncMqSend() | ||
147 | public void delete(Long id) { | 144 | public void delete(Long id) { |
148 | Assert.notNull(id, "The given id must not be null!"); | 145 | Assert.notNull(id, "The given id must not be null!"); |
149 | MemberProfile MemberProfile = this.memberProfileRepository.findById(id).orElseThrow( | 146 | MemberProfile MemberProfile = this.memberProfileRepository.findById(id).orElseThrow( |
... | @@ -158,19 +155,6 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -158,19 +155,6 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
158 | this.update(resources); | 155 | this.update(resources); |
159 | } | 156 | } |
160 | 157 | ||
161 | /** | ||
162 | * 同步会员信息 | ||
163 | * @param nickName | ||
164 | * @param gender | ||
165 | * @param birthday | ||
166 | * @param avatarUrl | ||
167 | * @param member | ||
168 | */ | ||
169 | private void synchronizedMemberData(String nickName , Integer gender , String birthday, | ||
170 | String avatarUrl,Member member) { | ||
171 | this.synchronizedMemberData(nickName,gender,birthday,avatarUrl,member.getId(),member.getCode()); | ||
172 | } | ||
173 | |||
174 | private void synchronizedMemberData(String nickName , Integer gender , String birthday, | 158 | private void synchronizedMemberData(String nickName , Integer gender , String birthday, |
175 | String avatarUrl,Long memberId,String memberCode) { | 159 | String avatarUrl,Long memberId,String memberCode) { |
176 | MemberProfile memberProfile = new MemberProfile(); | 160 | MemberProfile memberProfile = new MemberProfile(); | ... | ... |
... | @@ -69,7 +69,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -69,7 +69,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
69 | 69 | ||
70 | @Override | 70 | @Override |
71 | @Transactional(rollbackFor = Exception.class) | 71 | @Transactional(rollbackFor = Exception.class) |
72 | @AsyncMqSend | ||
73 | public void create(PointsAvailable resources) { | 72 | public void create(PointsAvailable resources) { |
74 | RLock rLock = this.redissonClient.getLock("PointsAvailable::create::id"+resources.getMemberId().toString()); | 73 | RLock rLock = this.redissonClient.getLock("PointsAvailable::create::id"+resources.getMemberId().toString()); |
75 | try { | 74 | try { | ... | ... |
... | @@ -58,7 +58,6 @@ public class PointsDetailServiceImpl implements PointsDetailService { | ... | @@ -58,7 +58,6 @@ public class PointsDetailServiceImpl implements PointsDetailService { |
58 | 58 | ||
59 | @Override | 59 | @Override |
60 | @Transactional(rollbackFor = Exception.class) | 60 | @Transactional(rollbackFor = Exception.class) |
61 | @AsyncMqSend | ||
62 | public void create(PointsDetail resources) { | 61 | public void create(PointsDetail resources) { |
63 | PointsDetailRepository.save(resources); | 62 | PointsDetailRepository.save(resources); |
64 | } | 63 | } | ... | ... |
... | @@ -64,7 +64,6 @@ public class PointsServiceImpl implements PointsService { | ... | @@ -64,7 +64,6 @@ public class PointsServiceImpl implements PointsService { |
64 | 64 | ||
65 | @Override | 65 | @Override |
66 | @Transactional(rollbackFor = Exception.class) | 66 | @Transactional(rollbackFor = Exception.class) |
67 | @AsyncMqSend() | ||
68 | public void create(Points resources) { | 67 | public void create(Points resources) { |
69 | Snowflake snowflake = IdUtil.createSnowflake(1, 1); | 68 | Snowflake snowflake = IdUtil.createSnowflake(1, 1); |
70 | resources.setId(snowflake.nextId()); | 69 | resources.setId(snowflake.nextId()); |
... | @@ -73,7 +72,6 @@ public class PointsServiceImpl implements PointsService { | ... | @@ -73,7 +72,6 @@ public class PointsServiceImpl implements PointsService { |
73 | 72 | ||
74 | @Override | 73 | @Override |
75 | @Transactional(rollbackFor = Exception.class) | 74 | @Transactional(rollbackFor = Exception.class) |
76 | @AsyncMqSend() | ||
77 | public void update(Points resources) { | 75 | public void update(Points resources) { |
78 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); | 76 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); |
79 | try { | 77 | try { |
... | @@ -92,7 +90,6 @@ public class PointsServiceImpl implements PointsService { | ... | @@ -92,7 +90,6 @@ public class PointsServiceImpl implements PointsService { |
92 | 90 | ||
93 | @Override | 91 | @Override |
94 | @Transactional(rollbackFor = Exception.class) | 92 | @Transactional(rollbackFor = Exception.class) |
95 | @AsyncMqSend() | ||
96 | public void delete(Long id) { | 93 | public void delete(Long id) { |
97 | Assert.notNull(id, "The given id must not be null!"); | 94 | Assert.notNull(id, "The given id must not be null!"); |
98 | Points Points = PointsRepository.findById(id).orElseThrow( | 95 | Points Points = PointsRepository.findById(id).orElseThrow( | ... | ... |
1 | package com.topdraw.business.module.points.standingbook.domain; | ||
2 | |||
3 | import lombok.Data; | ||
4 | import lombok.experimental.Accessors; | ||
5 | import cn.hutool.core.bean.BeanUtil; | ||
6 | import cn.hutool.core.bean.copier.CopyOptions; | ||
7 | import javax.persistence.*; | ||
8 | import org.springframework.data.annotation.CreatedDate; | ||
9 | import org.springframework.data.annotation.LastModifiedDate; | ||
10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
11 | import java.sql.Timestamp; | ||
12 | |||
13 | import java.io.Serializable; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2021-10-29 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="uc_points_standing_book") | ||
24 | public class PointsStandingBook implements Serializable { | ||
25 | |||
26 | // 主键 | ||
27 | @Id | ||
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
29 | @Column(name = "id") | ||
30 | private Long id; | ||
31 | |||
32 | // 积分生产 | ||
33 | @Column(name = "points_produce", nullable = false) | ||
34 | private Long pointsProduce; | ||
35 | |||
36 | // 积分消耗 | ||
37 | @Column(name = "points_consume", nullable = false) | ||
38 | private Long pointsConsume; | ||
39 | |||
40 | // 可用总积分 | ||
41 | @Column(name = "points_available", nullable = false) | ||
42 | private Long pointsAvailable; | ||
43 | |||
44 | // 积分过期 | ||
45 | @Column(name = "points_expire", nullable = false) | ||
46 | private Long pointsExpire; | ||
47 | |||
48 | // 日期 | ||
49 | @Column(name = "day") | ||
50 | private String day; | ||
51 | |||
52 | // 创建时间 | ||
53 | @CreatedDate | ||
54 | @Column(name = "create_time") | ||
55 | private Timestamp createTime; | ||
56 | |||
57 | // 创建时间 | ||
58 | @LastModifiedDate | ||
59 | @Column(name = "update_time") | ||
60 | private Timestamp updateTime; | ||
61 | |||
62 | public void copy(PointsStandingBook source){ | ||
63 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
64 | } | ||
65 | } |
1 | package com.topdraw.business.module.points.standingbook.repository; | ||
2 | |||
3 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2021-10-29 | ||
10 | */ | ||
11 | public interface PointsStandingBookRepository extends JpaRepository<PointsStandingBook, Long>, JpaSpecificationExecutor<PointsStandingBook> { | ||
12 | |||
13 | } |
1 | package com.topdraw.business.module.points.standingbook.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; | ||
5 | import com.topdraw.business.module.points.standingbook.service.PointsStandingBookService; | ||
6 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria; | ||
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-29 | ||
16 | */ | ||
17 | @Api(tags = "PointsStandingBook管理") | ||
18 | @RestController | ||
19 | @RequestMapping("/api/PointsStandingBook") | ||
20 | public class PointsStandingBookController { | ||
21 | |||
22 | @Autowired | ||
23 | private PointsStandingBookService PointsStandingBookService; | ||
24 | |||
25 | @GetMapping | ||
26 | @ApiOperation("查询PointsStandingBook") | ||
27 | public ResultInfo getPointsStandingBooks(PointsStandingBookQueryCriteria criteria, Pageable pageable) { | ||
28 | return ResultInfo.successPage(PointsStandingBookService.queryAll(criteria,pageable)); | ||
29 | } | ||
30 | |||
31 | @GetMapping(value = "/all") | ||
32 | @ApiOperation("查询所有PointsStandingBook") | ||
33 | public ResultInfo getPointsStandingBooks(PointsStandingBookQueryCriteria criteria) { | ||
34 | return ResultInfo.success(PointsStandingBookService.queryAll(criteria)); | ||
35 | } | ||
36 | |||
37 | @PostMapping | ||
38 | @ApiOperation("新增PointsStandingBook") | ||
39 | public ResultInfo create(@Validated @RequestBody PointsStandingBook resources) { | ||
40 | PointsStandingBookService.create(resources); | ||
41 | return ResultInfo.success(); | ||
42 | } | ||
43 | |||
44 | @PutMapping | ||
45 | @ApiOperation("修改PointsStandingBook") | ||
46 | public ResultInfo update(@Validated @RequestBody PointsStandingBook resources) { | ||
47 | PointsStandingBookService.update(resources); | ||
48 | return ResultInfo.success(); | ||
49 | } | ||
50 | |||
51 | @DeleteMapping(value = "/{id}") | ||
52 | @ApiOperation("删除PointsStandingBook") | ||
53 | public ResultInfo delete(@PathVariable Long id) { | ||
54 | PointsStandingBookService.delete(id); | ||
55 | return ResultInfo.success(); | ||
56 | } | ||
57 | |||
58 | } |
1 | package com.topdraw.business.module.points.standingbook.service; | ||
2 | |||
3 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; | ||
4 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO; | ||
5 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | ||
9 | |||
10 | /** | ||
11 | * @author XiangHan | ||
12 | * @date 2021-10-29 | ||
13 | */ | ||
14 | public interface PointsStandingBookService { | ||
15 | |||
16 | /** | ||
17 | * 查询数据分页 | ||
18 | * @param criteria 条件参数 | ||
19 | * @param pageable 分页参数 | ||
20 | * @return Map<String,Object> | ||
21 | */ | ||
22 | Map<String,Object> queryAll(PointsStandingBookQueryCriteria criteria, Pageable pageable); | ||
23 | |||
24 | /** | ||
25 | * 查询所有数据不分页 | ||
26 | * @param criteria 条件参数 | ||
27 | * @return List<PointsStandingBookDTO> | ||
28 | */ | ||
29 | List<PointsStandingBookDTO> queryAll(PointsStandingBookQueryCriteria criteria); | ||
30 | |||
31 | /** | ||
32 | * 根据ID查询 | ||
33 | * @param id ID | ||
34 | * @return PointsStandingBookDTO | ||
35 | */ | ||
36 | PointsStandingBookDTO findById(Long id); | ||
37 | |||
38 | void create(PointsStandingBook resources); | ||
39 | |||
40 | void update(PointsStandingBook resources); | ||
41 | |||
42 | void delete(Long id); | ||
43 | |||
44 | } |
1 | package com.topdraw.business.module.points.standingbook.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | import java.sql.Timestamp; | ||
5 | import java.io.Serializable; | ||
6 | |||
7 | |||
8 | /** | ||
9 | * @author XiangHan | ||
10 | * @date 2021-10-29 | ||
11 | */ | ||
12 | @Data | ||
13 | public class PointsStandingBookDTO implements Serializable { | ||
14 | |||
15 | // 主键 | ||
16 | private Long id; | ||
17 | |||
18 | // 积分生产 | ||
19 | private Long pointsProduce; | ||
20 | |||
21 | // 积分消耗 | ||
22 | private Long pointsConsume; | ||
23 | |||
24 | // 可用总积分 | ||
25 | private Long pointsAvailable; | ||
26 | |||
27 | // 积分过期 | ||
28 | private Long pointsExpire; | ||
29 | |||
30 | // 日期 | ||
31 | private String day; | ||
32 | |||
33 | // 创建时间 | ||
34 | private Timestamp createTime; | ||
35 | |||
36 | // 创建时间 | ||
37 | private Timestamp updateTime; | ||
38 | } |
1 | package com.topdraw.business.module.points.standingbook.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; | ||
4 | import com.topdraw.utils.ValidationUtil; | ||
5 | import com.topdraw.business.module.points.standingbook.repository.PointsStandingBookRepository; | ||
6 | import com.topdraw.business.module.points.standingbook.service.PointsStandingBookService; | ||
7 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO; | ||
8 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria; | ||
9 | import com.topdraw.business.module.points.standingbook.service.mapper.PointsStandingBookMapper; | ||
10 | import org.springframework.beans.factory.annotation.Autowired; | ||
11 | import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | ||
13 | import org.springframework.transaction.annotation.Transactional; | ||
14 | import 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 | |||
21 | import java.util.List; | ||
22 | import java.util.Map; | ||
23 | |||
24 | /** | ||
25 | * @author XiangHan | ||
26 | * @date 2021-10-29 | ||
27 | */ | ||
28 | @Service | ||
29 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
30 | public class PointsStandingBookServiceImpl implements PointsStandingBookService { | ||
31 | |||
32 | @Autowired | ||
33 | private PointsStandingBookRepository PointsStandingBookRepository; | ||
34 | |||
35 | @Autowired | ||
36 | private PointsStandingBookMapper PointsStandingBookMapper; | ||
37 | |||
38 | @Override | ||
39 | public Map<String, Object> queryAll(PointsStandingBookQueryCriteria criteria, Pageable pageable) { | ||
40 | Page<PointsStandingBook> page = PointsStandingBookRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
41 | return PageUtil.toPage(page.map(PointsStandingBookMapper::toDto)); | ||
42 | } | ||
43 | |||
44 | @Override | ||
45 | public List<PointsStandingBookDTO> queryAll(PointsStandingBookQueryCriteria criteria) { | ||
46 | return PointsStandingBookMapper.toDto(PointsStandingBookRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
47 | } | ||
48 | |||
49 | @Override | ||
50 | public PointsStandingBookDTO findById(Long id) { | ||
51 | PointsStandingBook PointsStandingBook = PointsStandingBookRepository.findById(id).orElseGet(PointsStandingBook::new); | ||
52 | ValidationUtil.isNull(PointsStandingBook.getId(),"PointsStandingBook","id",id); | ||
53 | return PointsStandingBookMapper.toDto(PointsStandingBook); | ||
54 | } | ||
55 | |||
56 | @Override | ||
57 | @Transactional(rollbackFor = Exception.class) | ||
58 | public void create(PointsStandingBook resources) { | ||
59 | PointsStandingBookRepository.save(resources); | ||
60 | } | ||
61 | |||
62 | @Override | ||
63 | @Transactional(rollbackFor = Exception.class) | ||
64 | public void update(PointsStandingBook resources) { | ||
65 | PointsStandingBook PointsStandingBook = PointsStandingBookRepository.findById(resources.getId()).orElseGet(PointsStandingBook::new); | ||
66 | ValidationUtil.isNull( PointsStandingBook.getId(),"PointsStandingBook","id",resources.getId()); | ||
67 | PointsStandingBook.copy(resources); | ||
68 | PointsStandingBookRepository.save(PointsStandingBook); | ||
69 | } | ||
70 | |||
71 | @Override | ||
72 | @Transactional(rollbackFor = Exception.class) | ||
73 | public void delete(Long id) { | ||
74 | Assert.notNull(id, "The given id must not be null!"); | ||
75 | PointsStandingBook PointsStandingBook = PointsStandingBookRepository.findById(id).orElseThrow( | ||
76 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsStandingBook.class, id), 1)); | ||
77 | PointsStandingBookRepository.delete(PointsStandingBook); | ||
78 | } | ||
79 | |||
80 | |||
81 | } |
1 | package com.topdraw.business.module.points.standingbook.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; | ||
5 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2021-10-29 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface PointsStandingBookMapper extends BaseMapper<PointsStandingBookDTO, PointsStandingBook> { | ||
15 | |||
16 | } |
1 | package com.topdraw.business.module.rights.history.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.rights.history.service.RightsHistoryService; | ||
5 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria; | ||
6 | import com.topdraw.util.TimestampUtil; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.data.domain.Pageable; | ||
9 | import org.springframework.web.bind.annotation.*; | ||
10 | import io.swagger.annotations.*; | ||
11 | |||
12 | /** | ||
13 | * @author XiangHan | ||
14 | * @date 2021-10-22 | ||
15 | */ | ||
16 | @Api(tags = "RightsHistory管理") | ||
17 | @RestController | ||
18 | @RequestMapping("/api/RightsHistory") | ||
19 | public class RightsHistoryController { | ||
20 | |||
21 | @Autowired | ||
22 | private RightsHistoryService RightsHistoryService; | ||
23 | |||
24 | @GetMapping(value = "/pageRightsHistory") | ||
25 | @ApiOperation("查询RightsHistory") | ||
26 | public ResultInfo pageRightsHistory(RightsHistoryQueryCriteria criteria, Pageable pageable) { | ||
27 | return ResultInfo.successPage(RightsHistoryService.queryAll(criteria,pageable)); | ||
28 | } | ||
29 | |||
30 | @GetMapping(value = "/pageAvailableRights") | ||
31 | @ApiOperation("查询用户可用权益列表") | ||
32 | public ResultInfo pageAvailableRights(RightsHistoryQueryCriteria criteria, Pageable pageable) { | ||
33 | criteria.setExpireTime(TimestampUtil.now()); | ||
34 | return ResultInfo.successPage(RightsHistoryService.queryAll(criteria,pageable)); | ||
35 | } | ||
36 | |||
37 | } |
... | @@ -14,21 +14,6 @@ import java.util.List; | ... | @@ -14,21 +14,6 @@ import java.util.List; |
14 | public interface RightsHistoryService { | 14 | public interface RightsHistoryService { |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * 查询数据分页 | ||
18 | * @param criteria 条件参数 | ||
19 | * @param pageable 分页参数 | ||
20 | * @return Map<String,Object> | ||
21 | */ | ||
22 | Map<String,Object> queryAll(RightsHistoryQueryCriteria criteria, Pageable pageable); | ||
23 | |||
24 | /** | ||
25 | * 查询所有数据不分页 | ||
26 | * @param criteria 条件参数 | ||
27 | * @return List<RightsHistoryDTO> | ||
28 | */ | ||
29 | List<RightsHistoryDTO> queryAll(RightsHistoryQueryCriteria criteria); | ||
30 | |||
31 | /** | ||
32 | * 根据ID查询 | 17 | * 根据ID查询 |
33 | * @param id ID | 18 | * @param id ID |
34 | * @return RightsHistoryDTO | 19 | * @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.aspect.AsyncMqSend; | ||
4 | import com.topdraw.business.module.rights.history.domain.RightsHistory; | 3 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
5 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
6 | import com.topdraw.business.module.rights.history.repository.RightsHistoryRepository; | 5 | import com.topdraw.business.module.rights.history.repository.RightsHistoryRepository; |
... | @@ -13,14 +12,7 @@ import org.springframework.stereotype.Service; | ... | @@ -13,14 +12,7 @@ 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 | |||
22 | import java.util.List; | ||
23 | import java.util.Map; | ||
24 | 16 | ||
25 | /** | 17 | /** |
26 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -37,17 +29,6 @@ public class RightsHistoryServiceImpl implements RightsHistoryService { | ... | @@ -37,17 +29,6 @@ public class RightsHistoryServiceImpl implements RightsHistoryService { |
37 | private RightsHistoryMapper RightsHistoryMapper; | 29 | private RightsHistoryMapper RightsHistoryMapper; |
38 | 30 | ||
39 | @Override | 31 | @Override |
40 | public Map<String, Object> queryAll(RightsHistoryQueryCriteria criteria, Pageable pageable) { | ||
41 | Page<RightsHistory> page = RightsHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
42 | return PageUtil.toPage(page.map(RightsHistoryMapper::toDto)); | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | public List<RightsHistoryDTO> queryAll(RightsHistoryQueryCriteria criteria) { | ||
47 | return RightsHistoryMapper.toDto(RightsHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
48 | } | ||
49 | |||
50 | @Override | ||
51 | public RightsHistoryDTO findById(Long id) { | 32 | public RightsHistoryDTO findById(Long id) { |
52 | RightsHistory RightsHistory = RightsHistoryRepository.findById(id).orElseGet(RightsHistory::new); | 33 | RightsHistory RightsHistory = RightsHistoryRepository.findById(id).orElseGet(RightsHistory::new); |
53 | ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",id); | 34 | ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",id); |
... | @@ -56,14 +37,12 @@ public class RightsHistoryServiceImpl implements RightsHistoryService { | ... | @@ -56,14 +37,12 @@ public class RightsHistoryServiceImpl implements RightsHistoryService { |
56 | 37 | ||
57 | @Override | 38 | @Override |
58 | @Transactional(rollbackFor = Exception.class) | 39 | @Transactional(rollbackFor = Exception.class) |
59 | @AsyncMqSend() | ||
60 | public void create(RightsHistory resources) { | 40 | public void create(RightsHistory resources) { |
61 | RightsHistoryRepository.save(resources); | 41 | RightsHistoryRepository.save(resources); |
62 | } | 42 | } |
63 | 43 | ||
64 | @Override | 44 | @Override |
65 | @Transactional(rollbackFor = Exception.class) | 45 | @Transactional(rollbackFor = Exception.class) |
66 | @AsyncMqSend() | ||
67 | public void update(RightsHistory resources) { | 46 | public void update(RightsHistory resources) { |
68 | RightsHistory RightsHistory = RightsHistoryRepository.findById(resources.getId()).orElseGet(RightsHistory::new); | 47 | RightsHistory RightsHistory = RightsHistoryRepository.findById(resources.getId()).orElseGet(RightsHistory::new); |
69 | ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",resources.getId()); | 48 | ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",resources.getId()); |
... | @@ -73,7 +52,6 @@ public class RightsHistoryServiceImpl implements RightsHistoryService { | ... | @@ -73,7 +52,6 @@ public class RightsHistoryServiceImpl implements RightsHistoryService { |
73 | 52 | ||
74 | @Override | 53 | @Override |
75 | @Transactional(rollbackFor = Exception.class) | 54 | @Transactional(rollbackFor = Exception.class) |
76 | @AsyncMqSend() | ||
77 | public void delete(Long id) { | 55 | public void delete(Long id) { |
78 | Assert.notNull(id, "The given id must not be null!"); | 56 | Assert.notNull(id, "The given id must not be null!"); |
79 | RightsHistory RightsHistory = RightsHistoryRepository.findById(id).orElseThrow( | 57 | RightsHistory RightsHistory = RightsHistoryRepository.findById(id).orElseThrow( | ... | ... |
... | @@ -56,14 +56,12 @@ public class PermanentRightsServiceImpl implements PermanentRightsService { | ... | @@ -56,14 +56,12 @@ public class PermanentRightsServiceImpl implements PermanentRightsService { |
56 | 56 | ||
57 | @Override | 57 | @Override |
58 | @Transactional(rollbackFor = Exception.class) | 58 | @Transactional(rollbackFor = Exception.class) |
59 | // @AsyncMqSend() | ||
60 | public void create(PermanentRights resources) { | 59 | public void create(PermanentRights resources) { |
61 | PermanentRightsRepository.save(resources); | 60 | PermanentRightsRepository.save(resources); |
62 | } | 61 | } |
63 | 62 | ||
64 | @Override | 63 | @Override |
65 | @Transactional(rollbackFor = Exception.class) | 64 | @Transactional(rollbackFor = Exception.class) |
66 | // @AsyncMqSend() | ||
67 | public void update(PermanentRights resources) { | 65 | public void update(PermanentRights resources) { |
68 | PermanentRights PermanentRights = PermanentRightsRepository.findById(resources.getId()).orElseGet(PermanentRights::new); | 66 | PermanentRights PermanentRights = PermanentRightsRepository.findById(resources.getId()).orElseGet(PermanentRights::new); |
69 | ValidationUtil.isNull( PermanentRights.getId(),"PermanentRights","id",resources.getId()); | 67 | ValidationUtil.isNull( PermanentRights.getId(),"PermanentRights","id",resources.getId()); | ... | ... |
... | @@ -69,14 +69,12 @@ public class RightsServiceImpl implements RightsService { | ... | @@ -69,14 +69,12 @@ public class RightsServiceImpl implements RightsService { |
69 | 69 | ||
70 | @Override | 70 | @Override |
71 | @Transactional(rollbackFor = Exception.class) | 71 | @Transactional(rollbackFor = Exception.class) |
72 | @AsyncMqSend() | ||
73 | public void create(Rights resources) { | 72 | public void create(Rights resources) { |
74 | RightsRepository.save(resources); | 73 | RightsRepository.save(resources); |
75 | } | 74 | } |
76 | 75 | ||
77 | @Override | 76 | @Override |
78 | @Transactional(rollbackFor = Exception.class) | 77 | @Transactional(rollbackFor = Exception.class) |
79 | @AsyncMqSend() | ||
80 | public void update(Rights resources) { | 78 | public void update(Rights resources) { |
81 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); | 79 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); |
82 | try { | 80 | try { |
... | @@ -94,7 +92,6 @@ public class RightsServiceImpl implements RightsService { | ... | @@ -94,7 +92,6 @@ public class RightsServiceImpl implements RightsService { |
94 | 92 | ||
95 | @Override | 93 | @Override |
96 | @Transactional(rollbackFor = Exception.class) | 94 | @Transactional(rollbackFor = Exception.class) |
97 | @AsyncMqSend() | ||
98 | public void delete(Long id) { | 95 | public void delete(Long id) { |
99 | Assert.notNull(id, "The given id must not be null!"); | 96 | Assert.notNull(id, "The given id must not be null!"); |
100 | Rights Rights = RightsRepository.findById(id).orElseThrow( | 97 | Rights Rights = RightsRepository.findById(id).orElseThrow( | ... | ... |
1 | package com.topdraw.business.module.task.attribute.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | ||
5 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; | ||
6 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrQueryCriteria; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.data.domain.Pageable; | ||
9 | import org.springframework.http.HttpStatus; | ||
10 | import org.springframework.http.ResponseEntity; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | import io.swagger.annotations.*; | ||
14 | import java.io.IOException; | ||
15 | import javax.servlet.http.HttpServletResponse; | ||
16 | |||
17 | /** | ||
18 | * @author XiangHan | ||
19 | * @date 2022-01-13 | ||
20 | */ | ||
21 | @Api(tags = "TaskAttr管理") | ||
22 | @RestController | ||
23 | @RequestMapping("/api/TaskAttr") | ||
24 | public class TaskAttrController { | ||
25 | |||
26 | @Autowired | ||
27 | private TaskAttrService TaskAttrService; | ||
28 | |||
29 | @GetMapping | ||
30 | @ApiOperation("查询TaskAttr") | ||
31 | public ResultInfo getTaskAttrs(TaskAttrQueryCriteria criteria, Pageable pageable) { | ||
32 | return ResultInfo.successPage(TaskAttrService.queryAll(criteria,pageable)); | ||
33 | } | ||
34 | |||
35 | @GetMapping(value = "/all") | ||
36 | @ApiOperation("查询所有TaskAttr") | ||
37 | public ResultInfo getTaskAttrs(TaskAttrQueryCriteria criteria) { | ||
38 | return ResultInfo.success(TaskAttrService.queryAll(criteria)); | ||
39 | } | ||
40 | |||
41 | @PostMapping | ||
42 | @ApiOperation("新增TaskAttr") | ||
43 | public ResultInfo create(@Validated @RequestBody TaskAttr resources) { | ||
44 | TaskAttrService.create(resources); | ||
45 | return ResultInfo.success(); | ||
46 | } | ||
47 | |||
48 | @PutMapping | ||
49 | @ApiOperation("修改TaskAttr") | ||
50 | public ResultInfo update(@Validated @RequestBody TaskAttr resources) { | ||
51 | TaskAttrService.update(resources); | ||
52 | return ResultInfo.success(); | ||
53 | } | ||
54 | |||
55 | @DeleteMapping(value = "/{id}") | ||
56 | @ApiOperation("删除TaskAttr") | ||
57 | public ResultInfo delete(@PathVariable Long id) { | ||
58 | TaskAttrService.delete(id); | ||
59 | return ResultInfo.success(); | ||
60 | } | ||
61 | |||
62 | } |
... | @@ -2,34 +2,12 @@ package com.topdraw.business.module.task.attribute.service; | ... | @@ -2,34 +2,12 @@ package com.topdraw.business.module.task.attribute.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | 3 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; |
4 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; | 4 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; |
5 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | ||
9 | import java.io.IOException; | ||
10 | import javax.servlet.http.HttpServletResponse; | ||
11 | 5 | ||
12 | /** | 6 | /** |
13 | * @author XiangHan | 7 | * @author XiangHan |
14 | * @date 2022-01-13 | 8 | * @date 2022-01-13 |
15 | */ | 9 | */ |
16 | public interface TaskAttrService { | 10 | public interface TaskAttrService { |
17 | |||
18 | /** | ||
19 | * 查询数据分页 | ||
20 | * @param criteria 条件参数 | ||
21 | * @param pageable 分页参数 | ||
22 | * @return Map<String,Object> | ||
23 | */ | ||
24 | Map<String,Object> queryAll(TaskAttrQueryCriteria criteria, Pageable pageable); | ||
25 | |||
26 | /** | ||
27 | * 查询所有数据不分页 | ||
28 | * @param criteria 条件参数 | ||
29 | * @return List<TaskAttrDTO> | ||
30 | */ | ||
31 | List<TaskAttrDTO> queryAll(TaskAttrQueryCriteria criteria); | ||
32 | |||
33 | /** | 11 | /** |
34 | * 根据ID查询 | 12 | * 根据ID查询 |
35 | * @param id ID | 13 | * @param id ID | ... | ... |
... | @@ -2,30 +2,16 @@ package com.topdraw.business.module.task.attribute.service.impl; | ... | @@ -2,30 +2,16 @@ package com.topdraw.business.module.task.attribute.service.impl; |
2 | 2 | ||
3 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | 3 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; |
4 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
5 | import com.topdraw.utils.FileUtil; | ||
6 | import com.topdraw.business.module.task.attribute.repository.TaskAttrRepository; | 5 | import com.topdraw.business.module.task.attribute.repository.TaskAttrRepository; |
7 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; | 6 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; |
8 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; | 7 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; |
9 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrQueryCriteria; | ||
10 | import com.topdraw.business.module.task.attribute.service.mapper.TaskAttrMapper; | 8 | import com.topdraw.business.module.task.attribute.service.mapper.TaskAttrMapper; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
13 | import org.springframework.transaction.annotation.Propagation; | 11 | import org.springframework.transaction.annotation.Propagation; |
14 | import org.springframework.transaction.annotation.Transactional; | 12 | import org.springframework.transaction.annotation.Transactional; |
15 | import org.springframework.dao.EmptyResultDataAccessException; | 13 | import org.springframework.dao.EmptyResultDataAccessException; |
16 | import org.springframework.data.domain.Page; | ||
17 | import org.springframework.data.domain.Pageable; | ||
18 | import org.springframework.util.Assert; | 14 | import org.springframework.util.Assert; |
19 | import com.topdraw.utils.PageUtil; | ||
20 | import com.topdraw.utils.QueryHelp; | ||
21 | import com.topdraw.utils.StringUtils; | ||
22 | |||
23 | import java.util.List; | ||
24 | import java.util.Map; | ||
25 | import java.io.IOException; | ||
26 | import javax.servlet.http.HttpServletResponse; | ||
27 | import java.util.ArrayList; | ||
28 | import java.util.LinkedHashMap; | ||
29 | 15 | ||
30 | /** | 16 | /** |
31 | * @author XiangHan | 17 | * @author XiangHan |
... | @@ -42,17 +28,6 @@ public class TaskAttrServiceImpl implements TaskAttrService { | ... | @@ -42,17 +28,6 @@ public class TaskAttrServiceImpl implements TaskAttrService { |
42 | private TaskAttrMapper TaskAttrMapper; | 28 | private TaskAttrMapper TaskAttrMapper; |
43 | 29 | ||
44 | @Override | 30 | @Override |
45 | public Map<String, Object> queryAll(TaskAttrQueryCriteria criteria, Pageable pageable) { | ||
46 | Page<TaskAttr> page = TaskAttrRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
47 | return PageUtil.toPage(page.map(TaskAttrMapper::toDto)); | ||
48 | } | ||
49 | |||
50 | @Override | ||
51 | public List<TaskAttrDTO> queryAll(TaskAttrQueryCriteria criteria) { | ||
52 | return TaskAttrMapper.toDto(TaskAttrRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
53 | } | ||
54 | |||
55 | @Override | ||
56 | public TaskAttrDTO findById(Long id) { | 31 | public TaskAttrDTO findById(Long id) { |
57 | TaskAttr TaskAttr = TaskAttrRepository.findById(id).orElseGet(TaskAttr::new); | 32 | TaskAttr TaskAttr = TaskAttrRepository.findById(id).orElseGet(TaskAttr::new); |
58 | ValidationUtil.isNull(TaskAttr.getId(),"TaskAttr","id",id); | 33 | ValidationUtil.isNull(TaskAttr.getId(),"TaskAttr","id",id); | ... | ... |
... | @@ -38,7 +38,6 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -38,7 +38,6 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
38 | 38 | ||
39 | @Override | 39 | @Override |
40 | @Transactional(rollbackFor = Exception.class) | 40 | @Transactional(rollbackFor = Exception.class) |
41 | @AsyncMqSend | ||
42 | public UserWeixin create(UserWeixin resources) { | 41 | public UserWeixin create(UserWeixin resources) { |
43 | UserWeixin build = UserWeixinBuilder.build(resources); | 42 | UserWeixin build = UserWeixinBuilder.build(resources); |
44 | UserWeixinRepository.save(build); | 43 | UserWeixinRepository.save(build); |
... | @@ -47,7 +46,6 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -47,7 +46,6 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
47 | 46 | ||
48 | @Override | 47 | @Override |
49 | @Transactional(rollbackFor = Exception.class) | 48 | @Transactional(rollbackFor = Exception.class) |
50 | @AsyncMqSend | ||
51 | public void update(UserWeixin resources) { | 49 | public void update(UserWeixin resources) { |
52 | UserWeixin UserWeixin = UserWeixinRepository.findById(resources.getId()).orElseGet(UserWeixin::new); | 50 | UserWeixin UserWeixin = UserWeixinRepository.findById(resources.getId()).orElseGet(UserWeixin::new); |
53 | ValidationUtil.isNull( UserWeixin.getId(),"UserWeixin","id",resources.getId()); | 51 | ValidationUtil.isNull( UserWeixin.getId(),"UserWeixin","id",resources.getId()); |
... | @@ -56,7 +54,6 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -56,7 +54,6 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
56 | } | 54 | } |
57 | 55 | ||
58 | @Override | 56 | @Override |
59 | @AsyncMqSend | ||
60 | public void updateTime(UserWeixin resources) { | 57 | public void updateTime(UserWeixin resources) { |
61 | UserWeixinRepository.updateTime(resources); | 58 | UserWeixinRepository.updateTime(resources); |
62 | } | 59 | } | ... | ... |
... | @@ -33,22 +33,6 @@ public class RightsOperationController { | ... | @@ -33,22 +33,6 @@ public class RightsOperationController { |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * | 35 | * |
36 | * @param criteria | ||
37 | * @param pageable | ||
38 | * @return | ||
39 | */ | ||
40 | @GetMapping | ||
41 | @ApiOperation("查询RightsHistory") | ||
42 | public ResultInfo queryRightsHistory(RightsHistoryQueryCriteria criteria, Pageable pageable) { | ||
43 | RightsHistoryQueryType queryType = criteria.getQueryType(); | ||
44 | if (queryType == RightsHistoryQueryType.AVAILABLE_ONLY) { | ||
45 | criteria.setExpireTime(TimestampUtil.now()); | ||
46 | } | ||
47 | return ResultInfo.successPage(rightsHistoryService.queryAll(criteria,pageable)); | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * | ||
52 | * @param id | 36 | * @param id |
53 | * @return | 37 | * @return |
54 | */ | 38 | */ | ... | ... |
member-service-impl/src/main/java/com/topdraw/weixin/beans/DefaultWeiXinBeanDefinition.java
deleted
100644 → 0
1 | package com.topdraw.weixin.beans; | ||
2 | |||
3 | import cn.hutool.core.date.DateUtil; | ||
4 | import cn.hutool.http.HttpUtil; | ||
5 | import com.alibaba.fastjson.JSONObject; | ||
6 | import com.topdraw.exception.BadRequestException; | ||
7 | import com.topdraw.utils.StringUtils; | ||
8 | import lombok.Data; | ||
9 | import org.springframework.beans.factory.annotation.Value; | ||
10 | import org.springframework.stereotype.Component; | ||
11 | |||
12 | import java.io.File; | ||
13 | import java.nio.charset.StandardCharsets; | ||
14 | import java.util.Base64; | ||
15 | import java.util.Date; | ||
16 | import java.util.UUID; | ||
17 | |||
18 | @Data | ||
19 | @Component | ||
20 | public class DefaultWeiXinBeanDefinition implements WeiXinBeanDefinition { | ||
21 | |||
22 | // | ||
23 | private String appid; | ||
24 | |||
25 | private String openId; | ||
26 | |||
27 | private String code; | ||
28 | |||
29 | private String token; | ||
30 | |||
31 | private String secret; | ||
32 | |||
33 | private String unionId; | ||
34 | |||
35 | private String nickname; | ||
36 | |||
37 | private String headImgUrl; | ||
38 | |||
39 | private JSONObject userInfo; | ||
40 | |||
41 | private String phoneNumber; | ||
42 | |||
43 | @Value("${file.upload:upload}") | ||
44 | private String filePath; | ||
45 | |||
46 | public DefaultWeiXinBeanDefinition() { | ||
47 | } | ||
48 | |||
49 | public DefaultWeiXinBeanDefinition(String appId, String code,String unionId,String openId, JSONObject userInfoWxJo,String phone) { | ||
50 | |||
51 | this.userInfo = userInfoWxJo; | ||
52 | if (userInfo != null) { | ||
53 | |||
54 | if (StringUtils.isNotBlank(userInfoWxJo.getString("unionId"))) { | ||
55 | unionId = userInfoWxJo.getString("unionId"); | ||
56 | } | ||
57 | |||
58 | if (StringUtils.isNotBlank(userInfoWxJo.getString("openId"))) { | ||
59 | openId = userInfoWxJo.getString("openId"); | ||
60 | } | ||
61 | |||
62 | headImgUrl = userInfoWxJo.getString("avatarUrl"); | ||
63 | |||
64 | if (StringUtils.isNotBlank(userInfoWxJo.getString("nickName"))) { | ||
65 | nickname = Base64.getEncoder().encodeToString(userInfoWxJo.getString("nickName").getBytes(StandardCharsets.UTF_8)); | ||
66 | } | ||
67 | |||
68 | String phoneNumber = userInfoWxJo.getString("phoneNumber"); | ||
69 | if (StringUtils.isBlank(phoneNumber)) { | ||
70 | throw new BadRequestException("phoneNumber is null..."); | ||
71 | } | ||
72 | |||
73 | this.phoneNumber = phoneNumber; | ||
74 | |||
75 | if (StringUtils.isNotBlank(headImgUrl)) { | ||
76 | |||
77 | new Thread(() -> { | ||
78 | String s = UUID.randomUUID().toString(); | ||
79 | File file = new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd")); | ||
80 | if (!file.exists()) { | ||
81 | file.mkdirs(); | ||
82 | } | ||
83 | |||
84 | HttpUtil.downloadFile(headImgUrl, new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg")); | ||
85 | |||
86 | headImgUrl = filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg"; | ||
87 | }).start(); | ||
88 | |||
89 | } | ||
90 | |||
91 | } | ||
92 | |||
93 | this.unionId = unionId; | ||
94 | this.phoneNumber = phone; | ||
95 | this.openId = openId; | ||
96 | this.appid = appId; | ||
97 | this.code = code; | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public String getAppId() { | ||
102 | return this.appid; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String getCode() { | ||
107 | return this.code; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public String getToken() { | ||
112 | return this.token; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public String getSecret() { | ||
117 | return this.secret; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public String getOpenId() { | ||
122 | return this.openId; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String getUnionId() { | ||
127 | return this.unionId; | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public String getNickname() { | ||
132 | return this.nickname; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public String getHeadImgUrl() { | ||
137 | return this.headImgUrl; | ||
138 | } | ||
139 | |||
140 | @Override | ||
141 | public JSONObject getUserInfo() { | ||
142 | return this.userInfo; | ||
143 | } | ||
144 | } |
1 | package com.topdraw.weixin.beans; | ||
2 | |||
3 | |||
4 | import lombok.AllArgsConstructor; | ||
5 | import lombok.Data; | ||
6 | import lombok.NoArgsConstructor; | ||
7 | |||
8 | @Data | ||
9 | @NoArgsConstructor | ||
10 | @AllArgsConstructor | ||
11 | public class WeiXinBean { | ||
12 | |||
13 | // | ||
14 | private String appid; | ||
15 | |||
16 | private String openId; | ||
17 | |||
18 | private String code; | ||
19 | |||
20 | private String token; | ||
21 | |||
22 | private String secret; | ||
23 | |||
24 | private String unionId; | ||
25 | |||
26 | private String nickname; | ||
27 | |||
28 | private String headImgUrl; | ||
29 | |||
30 | } |
member-service-impl/src/main/java/com/topdraw/weixin/beans/WeiXinBeanDefinition.java
deleted
100644 → 0
1 | package com.topdraw.weixin.beans; | ||
2 | |||
3 | import com.alibaba.fastjson.JSONObject; | ||
4 | |||
5 | public interface WeiXinBeanDefinition { | ||
6 | |||
7 | String getAppId(); | ||
8 | |||
9 | String getCode(); | ||
10 | |||
11 | String getToken(); | ||
12 | |||
13 | String getSecret(); | ||
14 | |||
15 | String getOpenId(); | ||
16 | |||
17 | String getUnionId(); | ||
18 | |||
19 | String getNickname(); | ||
20 | |||
21 | String getHeadImgUrl(); | ||
22 | |||
23 | JSONObject getUserInfo(); | ||
24 | } |
member-service-impl/src/main/java/com/topdraw/weixin/beans/config/WeiXinAppListConfig.java
deleted
100644 → 0
1 | package com.topdraw.weixin.beans.config; | ||
2 | |||
3 | import lombok.Data; | ||
4 | import org.springframework.beans.factory.annotation.Value; | ||
5 | import org.springframework.boot.context.properties.ConfigurationProperties; | ||
6 | import org.springframework.context.annotation.Configuration; | ||
7 | import org.springframework.stereotype.Component; | ||
8 | |||
9 | import java.util.List; | ||
10 | import java.util.Map; | ||
11 | |||
12 | @Data | ||
13 | @Configuration | ||
14 | @ConfigurationProperties(prefix = "weixin") | ||
15 | public class WeiXinAppListConfig { | ||
16 | |||
17 | private List<Map<String, String>> list; | ||
18 | |||
19 | /*@Value("${uc.service.platform:}") | ||
20 | private String platform; | ||
21 | |||
22 | @Value("${key:}") | ||
23 | private String key; | ||
24 | |||
25 | @Value("${uc.app.subAppId:wx05f35931270014be}") | ||
26 | private String subAppId; | ||
27 | |||
28 | @Value("${uc.app.h5AppId:wxca962918dfeed88c}") | ||
29 | private String h5AppId; | ||
30 | |||
31 | @Value("${uc.app.appletAppid:wxc57d42de3d351cec}") | ||
32 | private String appletAppid; | ||
33 | |||
34 | @Value("${file.upload:upload}") | ||
35 | private String filePath;*/ | ||
36 | |||
37 | } | ||
38 | |||
39 |
This diff is collapsed.
Click to expand it.
1 | package com.topdraw.test.business.basicdata.rights.history; | ||
2 | |||
3 | import com.topdraw.BaseTest; | ||
4 | import com.topdraw.business.module.rights.history.rest.RightsHistoryController; | ||
5 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import org.junit.Test; | ||
8 | import org.springframework.beans.factory.annotation.Autowired; | ||
9 | import org.springframework.data.domain.PageRequest; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | |||
12 | public class RightsHistoryControllerTest extends BaseTest { | ||
13 | |||
14 | |||
15 | @Autowired | ||
16 | RightsHistoryController rightsHistoryController; | ||
17 | |||
18 | @Test | ||
19 | public void pageRightsHistory(){ | ||
20 | RightsHistoryQueryCriteria memberQueryCriteria = new RightsHistoryQueryCriteria(); | ||
21 | memberQueryCriteria.setMemberId(1L); | ||
22 | Pageable pageable = PageRequest.of(0,20); | ||
23 | ResultInfo byId = this.rightsHistoryController.pageRightsHistory(memberQueryCriteria,pageable); | ||
24 | LOG.info("===>>>"+byId); | ||
25 | } | ||
26 | |||
27 | |||
28 | @Test | ||
29 | public void pageAvailableRights(){ | ||
30 | RightsHistoryQueryCriteria memberQueryCriteria = new RightsHistoryQueryCriteria(); | ||
31 | memberQueryCriteria.setMemberId(1L); | ||
32 | Pageable pageable = PageRequest.of(0,20); | ||
33 | ResultInfo byId = this.rightsHistoryController.pageAvailableRights(memberQueryCriteria,pageable); | ||
34 | LOG.info("===>>>"+byId); | ||
35 | } | ||
36 | |||
37 | } |
-
Please register or sign in to post a comment