1.update
Showing
33 changed files
with
46 additions
and
1275 deletions
... | @@ -33,8 +33,8 @@ | ... | @@ -33,8 +33,8 @@ |
33 | <!--代码生成器--> | 33 | <!--代码生成器--> |
34 | <dependency> | 34 | <dependency> |
35 | <groupId>com.topdraw</groupId> | 35 | <groupId>com.topdraw</groupId> |
36 | <artifactId>cronos-system</artifactId> | 36 | <artifactId>cronos-generator</artifactId> |
37 | <version>1.1.0</version> | 37 | <version>1.2.0</version> |
38 | </dependency> | 38 | </dependency> |
39 | 39 | ||
40 | <!-- Spring boot 热部署 : 此热部署会遇到 java.lang.ClassCastException 异常 --> | 40 | <!-- Spring boot 热部署 : 此热部署会遇到 java.lang.ClassCastException 异常 --> | ... | ... |
... | @@ -4,7 +4,6 @@ package com.topdraw; | ... | @@ -4,7 +4,6 @@ package com.topdraw; |
4 | import com.topdraw.utils.SpringContextHolder; | 4 | import com.topdraw.utils.SpringContextHolder; |
5 | import org.springframework.boot.SpringApplication; | 5 | import org.springframework.boot.SpringApplication; |
6 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
7 | import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; | ||
8 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | 7 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; |
9 | import org.springframework.boot.builder.SpringApplicationBuilder; | 8 | import org.springframework.boot.builder.SpringApplicationBuilder; |
10 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 9 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | ... | ... |
src/main/java/com/topdraw/business/module/coupon/history/rest/CouponHistoryController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.coupon.history.rest; | ||
2 | |||
3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; | ||
4 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; | ||
5 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-23 | ||
17 | */ | ||
18 | @Api(tags = "CouponHistory管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/CouponHistory") | ||
21 | public class CouponHistoryController { | ||
22 | |||
23 | @Autowired | ||
24 | private CouponHistoryService CouponHistoryService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询CouponHistory") | ||
28 | public ResultInfo getCouponHistorys(CouponHistoryQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(CouponHistoryService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有CouponHistory") | ||
34 | public ResultInfo getCouponHistorys(CouponHistoryQueryCriteria criteria) { | ||
35 | return ResultInfo.success(CouponHistoryService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增CouponHistory") | ||
40 | public ResultInfo create(@Validated @RequestBody CouponHistory resources) { | ||
41 | CouponHistoryService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改CouponHistory") | ||
47 | public ResultInfo update(@Validated @RequestBody CouponHistory resources) { | ||
48 | CouponHistoryService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | |||
53 | @DeleteMapping(value = "/{id}") | ||
54 | @ApiOperation("删除CouponHistory") | ||
55 | public ResultInfo delete(@PathVariable Long id) { | ||
56 | CouponHistoryService.delete(id); | ||
57 | return ResultInfo.success(); | ||
58 | } | ||
59 | |||
60 | } |
1 | package com.topdraw.business.module.coupon.rest; | ||
2 | |||
3 | import com.topdraw.business.module.coupon.domain.Coupon; | ||
4 | import com.topdraw.business.module.coupon.service.CouponService; | ||
5 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "Coupon管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/Coupon") | ||
21 | public class CouponController { | ||
22 | |||
23 | @Autowired | ||
24 | private CouponService CouponService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询Coupon") | ||
28 | public ResultInfo getCoupons(CouponQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(CouponService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有Coupon") | ||
34 | public ResultInfo getCoupons(CouponQueryCriteria criteria) { | ||
35 | return ResultInfo.success(CouponService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增Coupon") | ||
40 | public ResultInfo create(@Validated @RequestBody Coupon resources) { | ||
41 | CouponService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改Coupon") | ||
47 | public ResultInfo update(@Validated @RequestBody Coupon resources) { | ||
48 | CouponService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除Coupon") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | CouponService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | @GetMapping(value = "/getByCode/{code}") | ||
60 | @ApiOperation(value = "根据标识查询") | ||
61 | public ResultInfo getByCode(@PathVariable String code) { | ||
62 | return ResultInfo.success(CouponService.getByCode(code)); | ||
63 | } | ||
64 | } |
src/main/java/com/topdraw/business/module/exp/detail/rest/ExpDetailController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.exp.detail.rest; | ||
2 | |||
3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; | ||
4 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; | ||
5 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "ExpDetail管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/ExpDetail") | ||
21 | public class ExpDetailController { | ||
22 | |||
23 | @Autowired | ||
24 | private ExpDetailService ExpDetailService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询ExpDetail") | ||
28 | public ResultInfo getExpDetails(ExpDetailQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(ExpDetailService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有ExpDetail") | ||
34 | public ResultInfo getExpDetails(ExpDetailQueryCriteria criteria) { | ||
35 | return ResultInfo.success(ExpDetailService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增ExpDetail") | ||
40 | public ResultInfo create(@Validated @RequestBody ExpDetail resources) { | ||
41 | ExpDetailService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改ExpDetail") | ||
47 | public ResultInfo update(@Validated @RequestBody ExpDetail resources) { | ||
48 | ExpDetailService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除ExpDetail") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | ExpDetailService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | @GetMapping(value = "/getByCode/{code}") | ||
60 | @ApiOperation(value = "根据标识查询") | ||
61 | public ResultInfo getByCode(@PathVariable String code) { | ||
62 | return ResultInfo.success(ExpDetailService.getByCode(code)); | ||
63 | } | ||
64 | } |
src/main/java/com/topdraw/business/module/exp/history/rest/ExpHistoryController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.exp.history.rest; | ||
2 | |||
3 | import com.topdraw.business.module.exp.history.domain.ExpHistory; | ||
4 | import com.topdraw.business.module.exp.history.service.ExpHistoryService; | ||
5 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "ExpHistory管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/ExpHistory") | ||
21 | public class ExpHistoryController { | ||
22 | |||
23 | @Autowired | ||
24 | private ExpHistoryService ExpHistoryService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询ExpHistory") | ||
28 | public ResultInfo getExpHistorys(ExpHistoryQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(ExpHistoryService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有ExpHistory") | ||
34 | public ResultInfo getExpHistorys(ExpHistoryQueryCriteria criteria) { | ||
35 | return ResultInfo.success(ExpHistoryService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增ExpHistory") | ||
40 | public ResultInfo create(@Validated @RequestBody ExpHistory resources) { | ||
41 | ExpHistoryService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改ExpHistory") | ||
47 | public ResultInfo update(@Validated @RequestBody ExpHistory resources) { | ||
48 | ExpHistoryService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除ExpHistory") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | ExpHistoryService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | @GetMapping(value = "/getByCode/{code}") | ||
60 | @ApiOperation(value = "根据标识查询") | ||
61 | public ResultInfo getByCode(@PathVariable String code) { | ||
62 | return ResultInfo.success(ExpHistoryService.getByCode(code)); | ||
63 | } | ||
64 | } |
src/main/java/com/topdraw/business/module/member/address/rest/MemberAddressController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.member.address.rest; | ||
2 | |||
3 | import com.topdraw.business.module.member.address.domain.MemberAddress; | ||
4 | import com.topdraw.business.module.member.address.service.MemberAddressService; | ||
5 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "MemberAddress管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/MemberAddress") | ||
21 | public class MemberAddressController { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberAddressService MemberAddressService; | ||
25 | |||
26 | @GetMapping(value = "/pageMemberAddress") | ||
27 | @ApiOperation("查询MemberAddress") | ||
28 | public ResultInfo pageMemberAddress(MemberAddressQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(MemberAddressService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/findById/{id}") | ||
33 | @ApiOperation("查询指定MemberAddress") | ||
34 | public ResultInfo findById(@PathVariable(value = "id") Long id) { | ||
35 | return ResultInfo.success(MemberAddressService.findById(id)); | ||
36 | } | ||
37 | |||
38 | @PostMapping(value = "/create") | ||
39 | @ApiOperation("新增MemberAddress") | ||
40 | public ResultInfo create(@Validated @RequestBody MemberAddress resources) { | ||
41 | MemberAddressService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping(value = "/update") | ||
46 | @ApiOperation("修改MemberAddress") | ||
47 | public ResultInfo update(@Validated @RequestBody MemberAddress resources) { | ||
48 | MemberAddressService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/delete/{id}") | ||
53 | @ApiOperation("删除MemberAddress") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | MemberAddressService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | } |
src/main/java/com/topdraw/business/module/member/level/rest/MemberLevelController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.member.level.rest; | ||
2 | |||
3 | import com.topdraw.business.module.member.level.domain.MemberLevel; | ||
4 | import com.topdraw.business.module.member.level.service.MemberLevelService; | ||
5 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "MemberLevel管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/MemberLevel") | ||
21 | public class MemberLevelController { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberLevelService MemberLevelService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询MemberLevel") | ||
28 | public ResultInfo getMemberLevels(MemberLevelQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(MemberLevelService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有MemberLevel") | ||
34 | public ResultInfo getMemberLevels(MemberLevelQueryCriteria criteria) { | ||
35 | return ResultInfo.success(MemberLevelService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增MemberLevel") | ||
40 | public ResultInfo create(@Validated @RequestBody MemberLevel resources) { | ||
41 | MemberLevelService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改MemberLevel") | ||
47 | public ResultInfo update(@Validated @RequestBody MemberLevel resources) { | ||
48 | MemberLevelService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除MemberLevel") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | MemberLevelService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | @GetMapping(value = "/getByCode/{code}") | ||
60 | @ApiOperation(value = "根据标识查询") | ||
61 | public ResultInfo getByCode(@PathVariable String code) { | ||
62 | return ResultInfo.success(MemberLevelService.getByCode(code)); | ||
63 | } | ||
64 | } |
src/main/java/com/topdraw/business/module/member/profile/rest/MemberProfileController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.member.profile.rest; | ||
2 | |||
3 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
4 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | ||
5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "MemberProfile管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/MemberProfile") | ||
21 | public class MemberProfileController { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberProfileService MemberProfileService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询MemberProfile") | ||
28 | public ResultInfo getMemberProfiles(MemberProfileQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(MemberProfileService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有MemberProfile") | ||
34 | public ResultInfo getMemberProfiles(MemberProfileQueryCriteria criteria) { | ||
35 | return ResultInfo.success(MemberProfileService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增MemberProfile") | ||
40 | public ResultInfo create(@Validated @RequestBody MemberProfile resources) { | ||
41 | MemberProfileService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改MemberProfile") | ||
47 | public ResultInfo update(@Validated @RequestBody MemberProfile resources) { | ||
48 | MemberProfileService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除MemberProfile") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | MemberProfileService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | } |
1 | package com.topdraw.business.module.member.relatedinfo.rest; | ||
2 | |||
3 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; | ||
4 | import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService; | ||
5 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan /api/MemberRelatedInfo | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "MemberRelatedInfo管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/MemberRelatedInfo") | ||
21 | public class MemberRelatedInfoController { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberRelatedInfoService MemberRelatedInfoService; | ||
25 | |||
26 | @GetMapping(value = "/pageMemberRelatedInfos") | ||
27 | @ApiOperation("查询MemberRelatedInfo") | ||
28 | public ResultInfo pageMemberRelatedInfos(@Validated MemberRelatedInfoQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(MemberRelatedInfoService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @PostMapping(value = "/create") | ||
33 | @ApiOperation("新增MemberRelatedInfo") | ||
34 | public ResultInfo create(@Validated @RequestBody MemberRelatedInfo resources) { | ||
35 | MemberRelatedInfoService.create(resources); | ||
36 | return ResultInfo.success(); | ||
37 | } | ||
38 | |||
39 | @PutMapping(value = "/update") | ||
40 | @ApiOperation("修改MemberRelatedInfo") | ||
41 | public ResultInfo update(@Validated @RequestBody MemberRelatedInfo resources) { | ||
42 | MemberRelatedInfoService.update(resources); | ||
43 | return ResultInfo.success(); | ||
44 | } | ||
45 | |||
46 | @GetMapping(value = "/findById/{id}") | ||
47 | @ApiOperation("查询指定MemberRelatedInfo") | ||
48 | public ResultInfo findById(@PathVariable("id") Long id) { | ||
49 | return ResultInfo.success(MemberRelatedInfoService.findById(id)); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/delete//{id}") | ||
53 | @ApiOperation("删除MemberRelatedInfo") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | MemberRelatedInfoService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | } |
1 | package com.topdraw.business.module.member.rest; | ||
2 | |||
3 | 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.dto.MemberQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "Member管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/member") | ||
21 | public class MemberController { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberService memberService; | ||
25 | |||
26 | @GetMapping(value = "/pageMembers") | ||
27 | @ApiOperation("查询Member") | ||
28 | public ResultInfo pageMembers(MemberQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(memberService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/findById/{id}") | ||
33 | @ApiOperation("查询指定Member") | ||
34 | public ResultInfo findById(@PathVariable("id") Long id) { | ||
35 | return ResultInfo.success(memberService.findById(id)); | ||
36 | } | ||
37 | |||
38 | @PostMapping(value = "/create") | ||
39 | @ApiOperation("新增Member") | ||
40 | public ResultInfo create(@Validated @RequestBody Member resources) { | ||
41 | memberService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping(value = "/update") | ||
46 | @ApiOperation("修改Member") | ||
47 | public ResultInfo update(@Validated @RequestBody Member resources) { | ||
48 | memberService.update(resources); | ||
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(memberService.getByCode(code)); | ||
56 | } | ||
57 | } |
... | @@ -53,8 +53,8 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -53,8 +53,8 @@ public class MemberServiceImpl implements MemberService { |
53 | @Autowired | 53 | @Autowired |
54 | private com.topdraw.business.module.user.iptv.service.UserTvService UserTvService; | 54 | private com.topdraw.business.module.user.iptv.service.UserTvService UserTvService; |
55 | 55 | ||
56 | @Autowired | 56 | // @Autowired |
57 | private RedissonClient redissonClient; | 57 | // private RedissonClient redissonClient; |
58 | 58 | ||
59 | @Override | 59 | @Override |
60 | public Map<String, Object> queryAll(MemberQueryCriteria criteria, Pageable pageable) { | 60 | public Map<String, Object> queryAll(MemberQueryCriteria criteria, Pageable pageable) { |
... | @@ -148,7 +148,13 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -148,7 +148,13 @@ public class MemberServiceImpl implements MemberService { |
148 | resources.setBindIptvPlatformType(1); | 148 | resources.setBindIptvPlatformType(1); |
149 | resources.setBindIptvTime(LocalDateTime.now()); | 149 | resources.setBindIptvTime(LocalDateTime.now()); |
150 | } | 150 | } |
151 | |||
152 | } else { | ||
153 | resources.setUserIptvId(member.getUserIptvId()); | ||
154 | resources.setBindIptvPlatformType(member.getBindIptvPlatformType()); | ||
155 | resources.setBindIptvTime(member.getBindIptvTime()); | ||
151 | } | 156 | } |
157 | |||
152 | } | 158 | } |
153 | 159 | ||
154 | member.copy(resources); | 160 | member.copy(resources); |
... | @@ -164,9 +170,9 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -164,9 +170,9 @@ public class MemberServiceImpl implements MemberService { |
164 | @Transactional(rollbackFor = Exception.class) | 170 | @Transactional(rollbackFor = Exception.class) |
165 | public void delete(Long id) { | 171 | public void delete(Long id) { |
166 | Assert.notNull(id, "The given id must not be null!"); | 172 | Assert.notNull(id, "The given id must not be null!"); |
167 | RLock rLock = this.redissonClient.getLock("Member::delete::code" + id); | 173 | // RLock rLock = this.redissonClient.getLock("Member::delete::code" + id); |
168 | try { | 174 | try { |
169 | RedissonUtil.lock(rLock); | 175 | // RedissonUtil.lock(rLock); |
170 | Member member = memberRepository.findById(id).orElseThrow( | 176 | Member member = memberRepository.findById(id).orElseThrow( |
171 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", Member.class, id), 1)); | 177 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", Member.class, id), 1)); |
172 | memberRepository.delete(member); | 178 | memberRepository.delete(member); |
... | @@ -174,7 +180,7 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -174,7 +180,7 @@ public class MemberServiceImpl implements MemberService { |
174 | e.printStackTrace(); | 180 | e.printStackTrace(); |
175 | throw e; | 181 | throw e; |
176 | } finally { | 182 | } finally { |
177 | RedissonUtil.unlock(rLock); | 183 | // RedissonUtil.unlock(rLock); |
178 | } | 184 | } |
179 | } | 185 | } |
180 | 186 | ||
... | @@ -222,9 +228,7 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -222,9 +228,7 @@ public class MemberServiceImpl implements MemberService { |
222 | @Override | 228 | @Override |
223 | @Transactional(rollbackFor = Exception.class) | 229 | @Transactional(rollbackFor = Exception.class) |
224 | public void doUpdateMemberPoints(Member member) { | 230 | public void doUpdateMemberPoints(Member member) { |
225 | RLock rLock = this.redissonClient.getLock("Member::update::code::" + member.getCode()); | ||
226 | try { | 231 | try { |
227 | RedissonUtil.lock(rLock); | ||
228 | Long id = member.getId(); | 232 | Long id = member.getId(); |
229 | Long points = member.getPoints(); | 233 | Long points = member.getPoints(); |
230 | Long duePoints = member.getDuePoints(); | 234 | Long duePoints = member.getDuePoints(); |
... | @@ -232,8 +236,6 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -232,8 +236,6 @@ public class MemberServiceImpl implements MemberService { |
232 | } catch (Exception e) { | 236 | } catch (Exception e) { |
233 | e.printStackTrace(); | 237 | e.printStackTrace(); |
234 | throw e; | 238 | throw e; |
235 | } finally { | ||
236 | RedissonUtil.unlock(rLock); | ||
237 | } | 239 | } |
238 | } | 240 | } |
239 | 241 | ||
... | @@ -250,9 +252,7 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -250,9 +252,7 @@ public class MemberServiceImpl implements MemberService { |
250 | } | 252 | } |
251 | 253 | ||
252 | public void bindIptvId(Member resources) { | 254 | public void bindIptvId(Member resources) { |
253 | RLock rLock = this.redissonClient.getLock("Member::update::code::" + resources.getCode()); | ||
254 | try { | 255 | try { |
255 | RedissonUtil.lock(rLock); | ||
256 | Member member = memberRepository.findFirstByCode(resources.getCode()).orElseGet(Member::new); | 256 | Member member = memberRepository.findFirstByCode(resources.getCode()).orElseGet(Member::new); |
257 | if (member==null) { | 257 | if (member==null) { |
258 | ValidationUtil.isNull(member.getId(), "Member", "id", resources.getId()); | 258 | ValidationUtil.isNull(member.getId(), "Member", "id", resources.getId()); |
... | @@ -262,8 +262,6 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -262,8 +262,6 @@ public class MemberServiceImpl implements MemberService { |
262 | } catch (Exception e) { | 262 | } catch (Exception e) { |
263 | e.printStackTrace(); | 263 | e.printStackTrace(); |
264 | throw e; | 264 | throw e; |
265 | } finally { | ||
266 | RedissonUtil.unlock(rLock); | ||
267 | } | 265 | } |
268 | } | 266 | } |
269 | } | 267 | } | ... | ... |
... | @@ -24,6 +24,9 @@ import java.time.LocalDateTime; | ... | @@ -24,6 +24,9 @@ import java.time.LocalDateTime; |
24 | @Table(name="uc_member_vip_history") | 24 | @Table(name="uc_member_vip_history") |
25 | public class MemberVipHistory implements Serializable { | 25 | public class MemberVipHistory implements Serializable { |
26 | 26 | ||
27 | @Transient | ||
28 | private String memberCode; | ||
29 | |||
27 | // 主键 | 30 | // 主键 |
28 | @Id | 31 | @Id |
29 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 32 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ... | ... |
1 | package com.topdraw.business.module.member.viphistory.rest; | ||
2 | |||
3 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
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; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author luerlong | ||
16 | * @date 2021-12-10 | ||
17 | */ | ||
18 | @Api(tags = "MemberVipHistory管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/memberVipHistory") | ||
21 | public class MemberVipHistoryController { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberVipHistoryService memberVipHistoryService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询MemberVipHistory") | ||
28 | public ResultInfo getMemberVipHistorys(MemberVipHistoryQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(memberVipHistoryService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有MemberVipHistory") | ||
34 | public ResultInfo getMemberVipHistorys(MemberVipHistoryQueryCriteria criteria) { | ||
35 | return ResultInfo.success(memberVipHistoryService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增MemberVipHistory") | ||
40 | public ResultInfo create(@Validated @RequestBody MemberVipHistory resources) { | ||
41 | memberVipHistoryService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改MemberVipHistory") | ||
47 | public ResultInfo update(@Validated @RequestBody MemberVipHistory resources) { | ||
48 | memberVipHistoryService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除MemberVipHistory") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | memberVipHistoryService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | } |
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.service.MemberService; | ||
5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
4 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | 6 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; |
5 | import com.topdraw.business.module.member.viphistory.repository.MemberVipHistoryRepository; | 7 | import com.topdraw.business.module.member.viphistory.repository.MemberVipHistoryRepository; |
6 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | 8 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; |
... | @@ -10,6 +12,7 @@ import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHis | ... | @@ -10,6 +12,7 @@ import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHis |
10 | import com.topdraw.utils.PageUtil; | 12 | import com.topdraw.utils.PageUtil; |
11 | import com.topdraw.utils.QueryHelp; | 13 | import com.topdraw.utils.QueryHelp; |
12 | import com.topdraw.utils.ValidationUtil; | 14 | import com.topdraw.utils.ValidationUtil; |
15 | import lombok.extern.slf4j.Slf4j; | ||
13 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.dao.EmptyResultDataAccessException; | 17 | import org.springframework.dao.EmptyResultDataAccessException; |
15 | import org.springframework.data.domain.Page; | 18 | import org.springframework.data.domain.Page; |
... | @@ -22,6 +25,7 @@ import org.springframework.util.Assert; | ... | @@ -22,6 +25,7 @@ import org.springframework.util.Assert; |
22 | import java.time.LocalDateTime; | 25 | import java.time.LocalDateTime; |
23 | import java.util.List; | 26 | import java.util.List; |
24 | import java.util.Map; | 27 | import java.util.Map; |
28 | import java.util.Objects; | ||
25 | 29 | ||
26 | /** | 30 | /** |
27 | * @author luerlong | 31 | * @author luerlong |
... | @@ -29,6 +33,7 @@ import java.util.Map; | ... | @@ -29,6 +33,7 @@ import java.util.Map; |
29 | */ | 33 | */ |
30 | @Service | 34 | @Service |
31 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 35 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
36 | @Slf4j | ||
32 | public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { | 37 | public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { |
33 | 38 | ||
34 | @Autowired | 39 | @Autowired |
... | @@ -36,6 +41,8 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { | ... | @@ -36,6 +41,8 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { |
36 | 41 | ||
37 | @Autowired | 42 | @Autowired |
38 | private MemberVipHistoryMapper memberVipHistoryMapper; | 43 | private MemberVipHistoryMapper memberVipHistoryMapper; |
44 | @Autowired | ||
45 | private MemberService memberService; | ||
39 | 46 | ||
40 | @Override | 47 | @Override |
41 | public Map<String, Object> queryAll(MemberVipHistoryQueryCriteria criteria, Pageable pageable) { | 48 | public Map<String, Object> queryAll(MemberVipHistoryQueryCriteria criteria, Pageable pageable) { |
... | @@ -58,8 +65,16 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { | ... | @@ -58,8 +65,16 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { |
58 | @Override | 65 | @Override |
59 | @Transactional(rollbackFor = Exception.class) | 66 | @Transactional(rollbackFor = Exception.class) |
60 | public void create(MemberVipHistory resources) { | 67 | public void create(MemberVipHistory resources) { |
68 | log.info("MemberVipHistoryServiceImpl ==>> create ==>> resources ==>> [{}]",resources); | ||
69 | String memberCode = resources.getMemberCode(); | ||
70 | Assert.notNull(resources.getMemberCode(),"memberCode can't be null !!"); | ||
71 | MemberDTO byCode = memberService.getByCode(memberCode); | ||
72 | if (Objects.nonNull(byCode.getCode())) { | ||
73 | Long id = byCode.getId(); | ||
74 | resources.setMemberId(id); | ||
61 | memberVipHistoryRepository.save(resources); | 75 | memberVipHistoryRepository.save(resources); |
62 | } | 76 | } |
77 | } | ||
63 | 78 | ||
64 | @Override | 79 | @Override |
65 | @Transactional(rollbackFor = Exception.class) | 80 | @Transactional(rollbackFor = Exception.class) | ... | ... |
... | @@ -44,9 +44,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -44,9 +44,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
44 | private PointsAvailableMapper PointsAvailableMapper; | 44 | private PointsAvailableMapper PointsAvailableMapper; |
45 | 45 | ||
46 | @Autowired | 46 | @Autowired |
47 | private RedissonClient redissonClient; | ||
48 | |||
49 | @Autowired | ||
50 | private MemberService memberService; | 47 | private MemberService memberService; |
51 | 48 | ||
52 | @Override | 49 | @Override |
... | @@ -91,9 +88,7 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -91,9 +88,7 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
91 | @Override | 88 | @Override |
92 | @Transactional(rollbackFor = Exception.class) | 89 | @Transactional(rollbackFor = Exception.class) |
93 | public void update(PointsAvailable resources) { | 90 | public void update(PointsAvailable resources) { |
94 | RLock rLock = this.redissonClient.getLock("PointsAvailable::update::id"+resources.getMemberId().toString()); | ||
95 | try { | 91 | try { |
96 | RedissonUtil.lock(rLock); | ||
97 | PointsAvailable PointsAvailable = PointsAvailableRepository.findById(resources.getId()).orElseGet(PointsAvailable::new); | 92 | PointsAvailable PointsAvailable = PointsAvailableRepository.findById(resources.getId()).orElseGet(PointsAvailable::new); |
98 | ValidationUtil.isNull( PointsAvailable.getId(),"PointsAvailable","id",resources.getId()); | 93 | ValidationUtil.isNull( PointsAvailable.getId(),"PointsAvailable","id",resources.getId()); |
99 | PointsAvailable.copy(resources); | 94 | PointsAvailable.copy(resources); |
... | @@ -101,8 +96,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -101,8 +96,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
101 | } catch (Exception e) { | 96 | } catch (Exception e) { |
102 | e.printStackTrace(); | 97 | e.printStackTrace(); |
103 | throw e; | 98 | throw e; |
104 | } finally { | ||
105 | RedissonUtil.unlock(rLock); | ||
106 | } | 99 | } |
107 | } | 100 | } |
108 | 101 | ||
... | @@ -110,49 +103,37 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -110,49 +103,37 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
110 | @Transactional(rollbackFor = Exception.class) | 103 | @Transactional(rollbackFor = Exception.class) |
111 | public void delete(Long id) { | 104 | public void delete(Long id) { |
112 | Assert.notNull(id, "The given id must not be null!"); | 105 | Assert.notNull(id, "The given id must not be null!"); |
113 | RLock rLock = this.redissonClient.getLock("PointsAvailable::delete::id"+id); | ||
114 | try { | 106 | try { |
115 | RedissonUtil.lock(rLock); | ||
116 | PointsAvailable PointsAvailable = PointsAvailableRepository.findById(id).orElseThrow( | 107 | PointsAvailable PointsAvailable = PointsAvailableRepository.findById(id).orElseThrow( |
117 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsAvailable.class, id), 1)); | 108 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsAvailable.class, id), 1)); |
118 | PointsAvailableRepository.delete(PointsAvailable); | 109 | PointsAvailableRepository.delete(PointsAvailable); |
119 | } catch (Exception e) { | 110 | } catch (Exception e) { |
120 | e.printStackTrace(); | 111 | e.printStackTrace(); |
121 | throw e; | 112 | throw e; |
122 | } finally { | ||
123 | RedissonUtil.unlock(rLock); | ||
124 | } | 113 | } |
125 | } | 114 | } |
126 | 115 | ||
127 | @Override | 116 | @Override |
128 | public void delete4Custom(Long id) { | 117 | public void delete4Custom(Long id) { |
129 | Assert.notNull(id, "The given id must not be null!"); | 118 | Assert.notNull(id, "The given id must not be null!"); |
130 | RLock rLock = this.redissonClient.getLock("PointsAvailable::delete::id"+id); | ||
131 | try { | 119 | try { |
132 | RedissonUtil.lock(rLock); | ||
133 | PointsAvailable PointsAvailable = PointsAvailableRepository.findById(id).orElseThrow( | 120 | PointsAvailable PointsAvailable = PointsAvailableRepository.findById(id).orElseThrow( |
134 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsAvailable.class, id), 1)); | 121 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsAvailable.class, id), 1)); |
135 | PointsAvailableRepository.delete(PointsAvailable); | 122 | PointsAvailableRepository.delete(PointsAvailable); |
136 | } catch (Exception e) { | 123 | } catch (Exception e) { |
137 | e.printStackTrace(); | 124 | e.printStackTrace(); |
138 | throw e; | 125 | throw e; |
139 | } finally { | ||
140 | RedissonUtil.unlock(rLock); | ||
141 | } | 126 | } |
142 | } | 127 | } |
143 | 128 | ||
144 | @Override | 129 | @Override |
145 | @Transactional(rollbackFor = Exception.class) | 130 | @Transactional(rollbackFor = Exception.class) |
146 | public void deleteBatchByIds(List<Long> id) { | 131 | public void deleteBatchByIds(List<Long> id) { |
147 | RLock rLock = this.redissonClient.getLock("PointsAvailable::create::id"+id.get(0)); | ||
148 | try { | 132 | try { |
149 | RedissonUtil.lock(rLock); | ||
150 | PointsAvailableRepository.deleteBatchByIds(id); | 133 | PointsAvailableRepository.deleteBatchByIds(id); |
151 | } catch (Exception e) { | 134 | } catch (Exception e) { |
152 | e.printStackTrace(); | 135 | e.printStackTrace(); |
153 | throw e; | 136 | throw e; |
154 | } finally { | ||
155 | RedissonUtil.unlock(rLock); | ||
156 | } | 137 | } |
157 | } | 138 | } |
158 | 139 | ... | ... |
1 | package com.topdraw.business.module.points.rest; | ||
2 | |||
3 | import io.swagger.annotations.Api; | ||
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 | } |
... | @@ -40,9 +40,6 @@ public class PointsServiceImpl implements PointsService { | ... | @@ -40,9 +40,6 @@ public class PointsServiceImpl implements PointsService { |
40 | @Autowired | 40 | @Autowired |
41 | private PointsMapper PointsMapper; | 41 | private PointsMapper PointsMapper; |
42 | 42 | ||
43 | @Autowired | ||
44 | private RedissonClient redissonClient; | ||
45 | |||
46 | @Override | 43 | @Override |
47 | public Map<String, Object> queryAll(PointsQueryCriteria criteria, Pageable pageable) { | 44 | public Map<String, Object> queryAll(PointsQueryCriteria criteria, Pageable pageable) { |
48 | Page<Points> page = PointsRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | 45 | Page<Points> page = PointsRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
... | @@ -72,9 +69,7 @@ public class PointsServiceImpl implements PointsService { | ... | @@ -72,9 +69,7 @@ public class PointsServiceImpl implements PointsService { |
72 | @Override | 69 | @Override |
73 | @Transactional(rollbackFor = Exception.class) | 70 | @Transactional(rollbackFor = Exception.class) |
74 | public void update(Points resources) { | 71 | public void update(Points resources) { |
75 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); | ||
76 | try { | 72 | try { |
77 | RedissonUtil.lock(rLock); | ||
78 | Points Points = PointsRepository.findById(resources.getId()).orElseGet(Points::new); | 73 | Points Points = PointsRepository.findById(resources.getId()).orElseGet(Points::new); |
79 | ValidationUtil.isNull(Points.getId(), "Points", "id", resources.getId()); | 74 | ValidationUtil.isNull(Points.getId(), "Points", "id", resources.getId()); |
80 | Points.copy(resources); | 75 | Points.copy(resources); |
... | @@ -82,8 +77,6 @@ public class PointsServiceImpl implements PointsService { | ... | @@ -82,8 +77,6 @@ public class PointsServiceImpl implements PointsService { |
82 | } catch (Exception e) { | 77 | } catch (Exception e) { |
83 | e.printStackTrace(); | 78 | e.printStackTrace(); |
84 | throw e; | 79 | throw e; |
85 | } finally { | ||
86 | RedissonUtil.unlock(rLock); | ||
87 | } | 80 | } |
88 | } | 81 | } |
89 | 82 | ... | ... |
1 | package com.topdraw.business.module.points.standingbook.rest; | ||
2 | |||
3 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; | ||
4 | import com.topdraw.business.module.points.standingbook.service.PointsStandingBookService; | ||
5 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-29 | ||
17 | */ | ||
18 | @Api(tags = "PointsStandingBook管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/PointsStandingBook") | ||
21 | public class PointsStandingBookController { | ||
22 | |||
23 | @Autowired | ||
24 | private PointsStandingBookService PointsStandingBookService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询PointsStandingBook") | ||
28 | public ResultInfo getPointsStandingBooks(PointsStandingBookQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(PointsStandingBookService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有PointsStandingBook") | ||
34 | public ResultInfo getPointsStandingBooks(PointsStandingBookQueryCriteria criteria) { | ||
35 | return ResultInfo.success(PointsStandingBookService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增PointsStandingBook") | ||
40 | public ResultInfo create(@Validated @RequestBody PointsStandingBook resources) { | ||
41 | PointsStandingBookService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改PointsStandingBook") | ||
47 | public ResultInfo update(@Validated @RequestBody PointsStandingBook resources) { | ||
48 | PointsStandingBookService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除PointsStandingBook") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | PointsStandingBookService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | } |
src/main/java/com/topdraw/business/module/rights/history/rest/RightsHistoryController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.rights.history.rest; | ||
2 | |||
3 | import com.topdraw.business.module.rights.history.service.RightsHistoryService; | ||
4 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria; | ||
5 | import com.topdraw.common.ResultInfo; | ||
6 | import com.topdraw.util.TimestampUtil; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.web.bind.annotation.GetMapping; | ||
12 | import org.springframework.web.bind.annotation.RequestMapping; | ||
13 | import org.springframework.web.bind.annotation.RestController; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2021-10-22 | ||
18 | */ | ||
19 | @Api(tags = "RightsHistory管理") | ||
20 | @RestController | ||
21 | @RequestMapping("/api/RightsHistory") | ||
22 | public class RightsHistoryController { | ||
23 | |||
24 | @Autowired | ||
25 | private RightsHistoryService RightsHistoryService; | ||
26 | |||
27 | @GetMapping(value = "/pageRightsHistory") | ||
28 | @ApiOperation("查询RightsHistory") | ||
29 | public ResultInfo pageRightsHistory(RightsHistoryQueryCriteria criteria, Pageable pageable) { | ||
30 | return ResultInfo.successPage(RightsHistoryService.queryAll(criteria,pageable)); | ||
31 | } | ||
32 | |||
33 | @GetMapping(value = "/pageAvailableRights") | ||
34 | @ApiOperation("查询用户可用权益列表") | ||
35 | public ResultInfo pageAvailableRights(RightsHistoryQueryCriteria criteria, Pageable pageable) { | ||
36 | criteria.setExpireTime(TimestampUtil.now()); | ||
37 | return ResultInfo.successPage(RightsHistoryService.queryAll(criteria,pageable)); | ||
38 | } | ||
39 | |||
40 | } |
1 | package com.topdraw.business.module.rights.permanentrights.rest; | ||
2 | |||
3 | import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights; | ||
4 | import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService; | ||
5 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "PermanentRights管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/PermanentRights") | ||
21 | public class PermanentRightsController { | ||
22 | |||
23 | @Autowired | ||
24 | private PermanentRightsService PermanentRightsService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询PermanentRights") | ||
28 | public ResultInfo pagePermanentRights(PermanentRightsQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(PermanentRightsService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/findById/{id}") | ||
33 | @ApiOperation("查询PermanentRights") | ||
34 | public ResultInfo findById(@PathVariable("id") Long id) { | ||
35 | return ResultInfo.success(PermanentRightsService.findById(id)); | ||
36 | } | ||
37 | |||
38 | @PostMapping(value = "/create") | ||
39 | @ApiOperation("新增PermanentRights") | ||
40 | public ResultInfo create(@Validated @RequestBody PermanentRights resources) { | ||
41 | PermanentRightsService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping(value = "/update") | ||
46 | @ApiOperation("修改PermanentRights") | ||
47 | public ResultInfo update(@Validated @RequestBody PermanentRights resources) { | ||
48 | PermanentRightsService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/delete/{id}") | ||
53 | @ApiOperation("删除PermanentRights") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | PermanentRightsService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | @GetMapping(value = "/getByCode/{code}") | ||
60 | @ApiOperation(value = "根据标识查询") | ||
61 | public ResultInfo getByCode(@PathVariable String code) { | ||
62 | return ResultInfo.success(PermanentRightsService.getByCode(code)); | ||
63 | } | ||
64 | } |
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 | } |
1 | package com.topdraw.business.module.task.rest; | ||
2 | |||
3 | |||
4 | import com.topdraw.aop.log.Log; | ||
5 | import com.topdraw.business.module.task.domain.Task; | ||
6 | import com.topdraw.business.module.task.service.TaskService; | ||
7 | import com.topdraw.business.module.task.service.dto.TaskQueryCriteria; | ||
8 | import com.topdraw.common.ResultInfo; | ||
9 | import io.swagger.annotations.Api; | ||
10 | import io.swagger.annotations.ApiOperation; | ||
11 | import org.springframework.beans.factory.annotation.Autowired; | ||
12 | import org.springframework.data.domain.Pageable; | ||
13 | import org.springframework.validation.annotation.Validated; | ||
14 | import org.springframework.web.bind.annotation.*; | ||
15 | |||
16 | /** | ||
17 | * @author XiangHan | ||
18 | * @date 2021-10-22 | ||
19 | */ | ||
20 | @Api(tags = "Task管理") | ||
21 | @RestController | ||
22 | @RequestMapping("/api/Task") | ||
23 | public class TaskController { | ||
24 | |||
25 | @Autowired | ||
26 | private TaskService TaskService; | ||
27 | |||
28 | @GetMapping | ||
29 | @ApiOperation("查询Task") | ||
30 | public ResultInfo getTasks(TaskQueryCriteria criteria, Pageable pageable) { | ||
31 | return ResultInfo.successPage(TaskService.queryAll(criteria,pageable)); | ||
32 | } | ||
33 | |||
34 | @GetMapping(value = "/all") | ||
35 | @ApiOperation("查询所有Task") | ||
36 | public ResultInfo getTasks(TaskQueryCriteria criteria) { | ||
37 | return ResultInfo.success(TaskService.queryAll(criteria)); | ||
38 | } | ||
39 | |||
40 | @Log | ||
41 | @PostMapping | ||
42 | @ApiOperation("新增Task") | ||
43 | public ResultInfo create(@Validated @RequestBody Task resources) { | ||
44 | TaskService.create(resources); | ||
45 | return ResultInfo.success(); | ||
46 | } | ||
47 | |||
48 | @Log | ||
49 | @PutMapping | ||
50 | @ApiOperation("修改Task") | ||
51 | public ResultInfo update(@Validated @RequestBody Task resources) { | ||
52 | TaskService.update(resources); | ||
53 | return ResultInfo.success(); | ||
54 | } | ||
55 | |||
56 | |||
57 | @Log | ||
58 | @DeleteMapping(value = "/{id}") | ||
59 | @ApiOperation("删除Task") | ||
60 | public ResultInfo delete(@PathVariable Long id) { | ||
61 | TaskService.delete(id); | ||
62 | return ResultInfo.success(); | ||
63 | } | ||
64 | |||
65 | } |
src/main/java/com/topdraw/business/module/task/template/rest/TaskTemplateController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.task.template.rest; | ||
2 | |||
3 | import com.topdraw.business.module.task.template.domain.TaskTemplate; | ||
4 | import com.topdraw.business.module.task.template.service.TaskTemplateService; | ||
5 | import com.topdraw.business.module.task.template.service.dto.TaskTemplateQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Api(tags = "TaskTemplate管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/TaskTemplate") | ||
21 | public class TaskTemplateController { | ||
22 | |||
23 | @Autowired | ||
24 | private TaskTemplateService TaskTemplateService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询TaskTemplate") | ||
28 | public ResultInfo getTaskTemplates(TaskTemplateQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(TaskTemplateService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有TaskTemplate") | ||
34 | public ResultInfo getTaskTemplates(TaskTemplateQueryCriteria criteria) { | ||
35 | return ResultInfo.success(TaskTemplateService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增TaskTemplate") | ||
40 | public ResultInfo create(@Validated @RequestBody TaskTemplate resources) { | ||
41 | TaskTemplateService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改TaskTemplate") | ||
47 | public ResultInfo update(@Validated @RequestBody TaskTemplate resources) { | ||
48 | TaskTemplateService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除TaskTemplate") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | TaskTemplateService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | @GetMapping(value = "/getByCode/{code}") | ||
60 | @ApiOperation(value = "根据标识查询") | ||
61 | public ResultInfo getByCode(@PathVariable String code) { | ||
62 | return ResultInfo.success(TaskTemplateService.getByCode(code)); | ||
63 | } | ||
64 | } |
1 | package com.topdraw.business.module.user.iptv.rest; | ||
2 | |||
3 | import com.topdraw.business.module.user.iptv.domain.UserTv; | ||
4 | import com.topdraw.business.module.user.iptv.service.UserTvService; | ||
5 | import com.topdraw.business.module.user.iptv.service.dto.UserTvQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-12-16 | ||
17 | */ | ||
18 | @Api(tags = "UserTv管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/UserTv") | ||
21 | public class UserTvController { | ||
22 | |||
23 | @Autowired | ||
24 | private UserTvService UserTvService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询UserTv") | ||
28 | public ResultInfo getUserTvs(UserTvQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(UserTvService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有UserTv") | ||
34 | public ResultInfo getUserTvs(UserTvQueryCriteria criteria) { | ||
35 | return ResultInfo.success(UserTvService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增UserTv") | ||
40 | public ResultInfo create(@Validated @RequestBody UserTv resources) { | ||
41 | UserTvService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改UserTv") | ||
47 | public ResultInfo update(@Validated @RequestBody UserTv resources) { | ||
48 | UserTvService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除UserTv") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | UserTvService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | } |
src/main/java/com/topdraw/business/module/user/weixin/rest/UserWeixinController.java
deleted
100644 → 0
1 | package com.topdraw.business.module.user.weixin.rest; | ||
2 | |||
3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
4 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | ||
5 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | ||
6 | import com.topdraw.common.ResultInfo; | ||
7 | import io.swagger.annotations.Api; | ||
8 | import io.swagger.annotations.ApiOperation; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.domain.Pageable; | ||
11 | import org.springframework.validation.annotation.Validated; | ||
12 | import org.springframework.web.bind.annotation.*; | ||
13 | |||
14 | /** | ||
15 | * @author XiangHan | ||
16 | * @date 2021-12-16 | ||
17 | */ | ||
18 | @Api(tags = "UserWeixin管理") | ||
19 | @RestController | ||
20 | @RequestMapping("/api/UserWeixin") | ||
21 | public class UserWeixinController { | ||
22 | |||
23 | @Autowired | ||
24 | private UserWeixinService UserWeixinService; | ||
25 | |||
26 | @GetMapping | ||
27 | @ApiOperation("查询UserWeixin") | ||
28 | public ResultInfo getUserWeixins(UserWeixinQueryCriteria criteria, Pageable pageable) { | ||
29 | return ResultInfo.successPage(UserWeixinService.queryAll(criteria,pageable)); | ||
30 | } | ||
31 | |||
32 | @GetMapping(value = "/all") | ||
33 | @ApiOperation("查询所有UserWeixin") | ||
34 | public ResultInfo getUserWeixins(UserWeixinQueryCriteria criteria) { | ||
35 | return ResultInfo.success(UserWeixinService.queryAll(criteria)); | ||
36 | } | ||
37 | |||
38 | @PostMapping | ||
39 | @ApiOperation("新增UserWeixin") | ||
40 | public ResultInfo create(@Validated @RequestBody UserWeixin resources) { | ||
41 | UserWeixinService.create(resources); | ||
42 | return ResultInfo.success(); | ||
43 | } | ||
44 | |||
45 | @PutMapping | ||
46 | @ApiOperation("修改UserWeixin") | ||
47 | public ResultInfo update(@Validated @RequestBody UserWeixin resources) { | ||
48 | UserWeixinService.update(resources); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @DeleteMapping(value = "/{id}") | ||
53 | @ApiOperation("删除UserWeixin") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | UserWeixinService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | } |
... | @@ -8,11 +8,9 @@ import com.topdraw.business.module.user.weixin.service.UserWeixinService; | ... | @@ -8,11 +8,9 @@ import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
8 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 8 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
9 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | 9 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; |
10 | import com.topdraw.business.module.user.weixin.service.mapper.UserWeixinMapper; | 10 | import com.topdraw.business.module.user.weixin.service.mapper.UserWeixinMapper; |
11 | import com.topdraw.util.TimestampUtil; | ||
12 | import com.topdraw.utils.PageUtil; | 11 | import com.topdraw.utils.PageUtil; |
13 | import com.topdraw.utils.QueryHelp; | 12 | import com.topdraw.utils.QueryHelp; |
14 | import com.topdraw.utils.ValidationUtil; | 13 | import com.topdraw.utils.ValidationUtil; |
15 | import jdk.vm.ci.meta.Local; | ||
16 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
17 | import org.springframework.beans.BeanUtils; | 15 | import org.springframework.beans.BeanUtils; |
18 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
... | @@ -41,8 +41,6 @@ public class CouponOperationServiceImpl implements CouponOperationService { | ... | @@ -41,8 +41,6 @@ public class CouponOperationServiceImpl implements CouponOperationService { |
41 | @Autowired | 41 | @Autowired |
42 | MemberService memberService; | 42 | MemberService memberService; |
43 | @Autowired | 43 | @Autowired |
44 | RedissonClient redissonClient; | ||
45 | @Autowired | ||
46 | ThreadPoolTaskExecutor threadPoolTaskExecutor; | 44 | ThreadPoolTaskExecutor threadPoolTaskExecutor; |
47 | 45 | ||
48 | // 过期阀值(默认一个月) | 46 | // 过期阀值(默认一个月) |
... | @@ -90,9 +88,7 @@ public class CouponOperationServiceImpl implements CouponOperationService { | ... | @@ -90,9 +88,7 @@ public class CouponOperationServiceImpl implements CouponOperationService { |
90 | // Long userId = tempCoupon.getUserId(); | 88 | // Long userId = tempCoupon.getUserId(); |
91 | Long memberId = tempCoupon.getMemberId(); | 89 | Long memberId = tempCoupon.getMemberId(); |
92 | Integer rightsAmount = tempCoupon.getRightsAmount(); | 90 | Integer rightsAmount = tempCoupon.getRightsAmount(); |
93 | RLock rLock = this.redissonClient.getLock("refreshMemberCoupon:" + memberId.toString()); | ||
94 | try { | 91 | try { |
95 | RedissonUtil.lock(rLock); | ||
96 | // 1.历史总优惠券数量 | 92 | // 1.历史总优惠券数量 |
97 | Long historyCouponCount = this.getTotalHistoryCoupon(memberId); | 93 | Long historyCouponCount = this.getTotalHistoryCoupon(memberId); |
98 | // 1.当前总优惠券数量 | 94 | // 1.当前总优惠券数量 |
... | @@ -108,8 +104,6 @@ public class CouponOperationServiceImpl implements CouponOperationService { | ... | @@ -108,8 +104,6 @@ public class CouponOperationServiceImpl implements CouponOperationService { |
108 | } catch (Exception e) { | 104 | } catch (Exception e) { |
109 | e.printStackTrace(); | 105 | e.printStackTrace(); |
110 | throw e; | 106 | throw e; |
111 | } finally { | ||
112 | RedissonUtil.unlock(rLock); | ||
113 | } | 107 | } |
114 | } | 108 | } |
115 | 109 | ... | ... |
... | @@ -44,8 +44,6 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -44,8 +44,6 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
44 | @Autowired | 44 | @Autowired |
45 | MemberService memberService; | 45 | MemberService memberService; |
46 | @Autowired | 46 | @Autowired |
47 | RedissonClient redissonClient; | ||
48 | @Autowired | ||
49 | ThreadPoolTaskExecutor threadPoolTaskExecutor; | 47 | ThreadPoolTaskExecutor threadPoolTaskExecutor; |
50 | 48 | ||
51 | @Override | 49 | @Override |
... | @@ -81,9 +79,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -81,9 +79,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
81 | MemberDTO memberDTO = this.memberService.getByCode(memberCode); | 79 | MemberDTO memberDTO = this.memberService.getByCode(memberCode); |
82 | Long id = memberDTO.getId(); | 80 | Long id = memberDTO.getId(); |
83 | tempExp.setId(id); | 81 | tempExp.setId(id); |
84 | RLock lock = this.redissonClient.getLock("uc-refresh-exp:" + tempExp.getMemberId()); | ||
85 | try { | 82 | try { |
86 | RedissonUtil.lock(lock); | ||
87 | // 原始积分 | 83 | // 原始积分 |
88 | long originExp = this.getExpByMemberId(tempExp); | 84 | long originExp = this.getExpByMemberId(tempExp); |
89 | // 总积分 | 85 | // 总积分 |
... | @@ -98,8 +94,6 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -98,8 +94,6 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
98 | } catch (Exception e) { | 94 | } catch (Exception e) { |
99 | e.printStackTrace(); | 95 | e.printStackTrace(); |
100 | throw e; | 96 | throw e; |
101 | } finally { | ||
102 | RedissonUtil.unlock(lock); | ||
103 | } | 97 | } |
104 | } | 98 | } |
105 | 99 | ... | ... |
... | @@ -64,9 +64,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -64,9 +64,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
64 | 64 | ||
65 | private static final String DELETE_AVAILABLE_POINTS = "delete"; | 65 | private static final String DELETE_AVAILABLE_POINTS = "delete"; |
66 | private static final String INSERT_AVAILABLE_POINTS = "insert"; | 66 | private static final String INSERT_AVAILABLE_POINTS = "insert"; |
67 | |||
68 | @Autowired | ||
69 | RedissonClient redissonClient; | ||
70 | @Autowired | 67 | @Autowired |
71 | ThreadPoolTaskExecutor threadPoolTaskExecutor; | 68 | ThreadPoolTaskExecutor threadPoolTaskExecutor; |
72 | 69 | ||
... | @@ -110,9 +107,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -110,9 +107,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
110 | 107 | ||
111 | Long memberId = memberDTO.getId(); | 108 | Long memberId = memberDTO.getId(); |
112 | tempPoints.setMemberId(memberId); | 109 | tempPoints.setMemberId(memberId); |
113 | RLock rLock = this.redissonClient.getLock("member::id::" + memberId.toString()); | ||
114 | try { | 110 | try { |
115 | RedissonUtil.lock(rLock); | ||
116 | //1.删除过期的积分 | 111 | //1.删除过期的积分 |
117 | this.cleanInvalidAvailablePointsByMemberId(memberId); | 112 | this.cleanInvalidAvailablePointsByMemberId(memberId); |
118 | // 1.判断可用积分是否够用 | 113 | // 1.判断可用积分是否够用 |
... | @@ -139,8 +134,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -139,8 +134,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
139 | }catch (Exception e) { | 134 | }catch (Exception e) { |
140 | e.printStackTrace(); | 135 | e.printStackTrace(); |
141 | throw e; | 136 | throw e; |
142 | } finally { | ||
143 | RedissonUtil.unlock(rLock); | ||
144 | } | 137 | } |
145 | 138 | ||
146 | } | 139 | } |
... | @@ -415,10 +408,8 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -415,10 +408,8 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
415 | private void refresh(TempPoints tempPoints) { | 408 | private void refresh(TempPoints tempPoints) { |
416 | Long memberId = tempPoints.getMemberId(); | 409 | Long memberId = tempPoints.getMemberId(); |
417 | log.info("----------->> points refresh start"); | 410 | log.info("----------->> points refresh start"); |
418 | RLock rLock = this.redissonClient.getLock("member::id::" + memberId.toString()); | ||
419 | log.info("----------->> rLock --->> start" ); | 411 | log.info("----------->> rLock --->> start" ); |
420 | try { | 412 | try { |
421 | RedissonUtil.lock(rLock); | ||
422 | log.info("----------->> refresh findAvailablePointsByMemberId start"); | 413 | log.info("----------->> refresh findAvailablePointsByMemberId start"); |
423 | // 1.可用总积分 | 414 | // 1.可用总积分 |
424 | Long currentPoints = this.findAvailablePointsByMemberId(memberId); | 415 | Long currentPoints = this.findAvailablePointsByMemberId(memberId); |
... | @@ -448,8 +439,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -448,8 +439,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
448 | } catch (Exception e) { | 439 | } catch (Exception e) { |
449 | e.printStackTrace(); | 440 | e.printStackTrace(); |
450 | throw e; | 441 | throw e; |
451 | } finally { | ||
452 | RedissonUtil.unlock(rLock); | ||
453 | } | 442 | } |
454 | } | 443 | } |
455 | 444 | ... | ... |
1 | package com.topdraw.config; | ||
2 | |||
3 | import com.topdraw.utils.StringUtils; | ||
4 | import org.redisson.Redisson; | ||
5 | import org.redisson.config.Config; | ||
6 | import org.springframework.beans.factory.annotation.Value; | ||
7 | import org.springframework.context.annotation.Bean; | ||
8 | import org.springframework.context.annotation.Configuration; | ||
9 | |||
10 | @Configuration | ||
11 | public class RedissonConfig { | ||
12 | |||
13 | @Value("${spring.redis.host}") | ||
14 | private String redisHost; | ||
15 | |||
16 | @Value("${spring.redis.port}") | ||
17 | private String port; | ||
18 | |||
19 | @Value("${spring.redis.password}") | ||
20 | private String password; | ||
21 | |||
22 | @Bean | ||
23 | public Redisson redisson(){ | ||
24 | Config config = new Config(); | ||
25 | if (StringUtils.isNotEmpty(password)) { | ||
26 | config.useSingleServer().setAddress("redis://"+redisHost+":"+port).setPassword(password); | ||
27 | } else { | ||
28 | config.useSingleServer().setAddress("redis://"+redisHost+":"+port); | ||
29 | } | ||
30 | /* config.useClusterServers().addNodeAddress( | ||
31 | "redis://172.29.3.245:6375","redis://172.29.3.245:6376", "redis://172.29.3.245:6377", | ||
32 | "redis://172.29.3.245:6378","redis://172.29.3.245:6i379", "redis://172.29.3.245:6380") | ||
33 | .setPassword("a123456").setScanInterval(5000);*/ | ||
34 | Redisson redissonClient = (Redisson)Redisson.create(config); | ||
35 | return redissonClient; | ||
36 | } | ||
37 | |||
38 | } |
... | @@ -26,12 +26,6 @@ public class WeiXinEventConsumer { | ... | @@ -26,12 +26,6 @@ public class WeiXinEventConsumer { |
26 | @Autowired | 26 | @Autowired |
27 | private RestTemplateClient restTemplateClient; | 27 | private RestTemplateClient restTemplateClient; |
28 | 28 | ||
29 | @Value("${subAppId:wx05f35931270014be}") | ||
30 | private String subAppId; | ||
31 | |||
32 | @Autowired | ||
33 | private RedisUtils redisUtils; | ||
34 | |||
35 | private static final String QR_CODE_URL = "QR_CODE_URL_"; | 29 | private static final String QR_CODE_URL = "QR_CODE_URL_"; |
36 | 30 | ||
37 | /** | 31 | /** |
... | @@ -41,50 +35,11 @@ public class WeiXinEventConsumer { | ... | @@ -41,50 +35,11 @@ public class WeiXinEventConsumer { |
41 | @RabbitHandler | 35 | @RabbitHandler |
42 | @RabbitListener(bindings = { | 36 | @RabbitListener(bindings = { |
43 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_QUEUE), | 37 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_QUEUE), |
44 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | 38 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
39 | containerFactory = "managementRabbitListenerContainerFactory") | ||
45 | public void deleteCollection(String content) { | 40 | public void deleteCollection(String content) { |
46 | try { | 41 | try { |
47 | log.info("receive UserCollection delete message, content {}", content); | 42 | log.info("receive UserCollection delete message, content {}", content); |
48 | JSONObject jsonObject = JSONObject.parseObject(content); | ||
49 | String platformAccount = jsonObject.getString("platformAccount"); | ||
50 | String data = jsonObject.getString("data"); | ||
51 | if (StringUtils.isBlank(data) || !data.startsWith("[")) { | ||
52 | // return; | ||
53 | } | ||
54 | /*Optional<TvUser> userOptional = tvUserRepository.findByPlatformAccount(platformAccount); | ||
55 | if (!userOptional.isPresent()) { | ||
56 | return; | ||
57 | } | ||
58 | Long id = userOptional.get().getId(); | ||
59 | List<UserCollectionMq> userCollectionMqList = JSONObject.parseArray(data, UserCollectionMq.class); | ||
60 | if (userCollectionMqList == null || userCollectionMqList.isEmpty()) { | ||
61 | return; | ||
62 | } | ||
63 | Map<Long, List<UserCollectionMq>> collect = userCollectionMqList.stream().collect(Collectors.groupingBy(UserCollectionMq::getUserCollectionId)); | ||
64 | for (Map.Entry<Long, List<UserCollectionMq>> entry : collect.entrySet()) { | ||
65 | List<UserCollectionMq> value = entry.getValue(); | ||
66 | UserCollectionMq userCollectionMq = value.get(0); | ||
67 | if (StringUtils.isBlank(userCollectionMq.getName())) { | ||
68 | userCollectionMq.setName("DEFAULT"); | ||
69 | } | ||
70 | Optional<UserCollection> userCollectionOptional = userCollectionRepository.findFirstByUserIdAndTypeAndName(id, userCollectionMq.getType(), userCollectionMq.getName()); | ||
71 | UserCollection userCollection = userCollectionOptional.orElseGet(UserCollection::new); | ||
72 | int count = 0; | ||
73 | for (UserCollectionMq collectionMq : value) { | ||
74 | collectionMq.setUserCollectionId(userCollection.getId()); | ||
75 | List<UserCollectionDetail> userCollectionDetailOptional = userCollectionDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, collectionMq, criteriaBuilder)); | ||
76 | if (!userCollectionDetailOptional.isEmpty()) { | ||
77 | userCollectionDetailRepository.deleteAll(userCollectionDetailOptional); | ||
78 | count++; | ||
79 | } | ||
80 | } | ||
81 | userCollection.setAppId(userCollectionMq.getAppId()) | ||
82 | .setUserId(id) | ||
83 | .setName(userCollectionMq.getName()) | ||
84 | .setType(userCollectionMq.getType()) | ||
85 | .setCount(userCollection.getCount() - count); | ||
86 | userCollectionRepository.save(userCollection); | ||
87 | }*/ | ||
88 | this.restTemplateClient.deleteCollection(content); | 43 | this.restTemplateClient.deleteCollection(content); |
89 | } catch (Exception e) { | 44 | } catch (Exception e) { |
90 | log.error("CollectionDeleteConsumer || UserCollection delete error || {}", e.toString(), e); | 45 | log.error("CollectionDeleteConsumer || UserCollection delete error || {}", e.toString(), e); |
... | @@ -98,26 +53,12 @@ public class WeiXinEventConsumer { | ... | @@ -98,26 +53,12 @@ public class WeiXinEventConsumer { |
98 | @RabbitHandler | 53 | @RabbitHandler |
99 | @RabbitListener(bindings = { | 54 | @RabbitListener(bindings = { |
100 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_ALL_QUEUE), | 55 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_ALL_QUEUE), |
101 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | 56 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
57 | containerFactory = "managementRabbitListenerContainerFactory") | ||
102 | @Transactional | 58 | @Transactional |
103 | public void deleteAllCollection(String content) { | 59 | public void deleteAllCollection(String content) { |
104 | try { | 60 | try { |
105 | log.info("receive UserCollection delete all message, content {}", content); | 61 | log.info("receive UserCollection delete all message, content {}", content); |
106 | JSONObject jsonObject = JSONObject.parseObject(content); | ||
107 | String platformAccount = jsonObject.getString("platformAccount"); | ||
108 | Integer type = jsonObject.getInteger("collectionType"); | ||
109 | /* Optional<TvUser> userOptional = tvUserRepository.findByPlatformAccount(platformAccount); | ||
110 | if (!userOptional.isPresent()) { | ||
111 | return; | ||
112 | } | ||
113 | Long id = userOptional.get().getId(); | ||
114 | List<UserCollection> userCollections = userCollectionRepository.findByUserIdAndType(id, type); | ||
115 | if (userCollections == null || userCollections.isEmpty()) { | ||
116 | return; | ||
117 | } | ||
118 | for (UserCollection userCollection : userCollections) { | ||
119 | userCollectionDetailRepository.deleteAllByUserCollectionId(userCollection.getId()); | ||
120 | }*/ | ||
121 | this.restTemplateClient.deleteAllCollection(content); | 62 | this.restTemplateClient.deleteAllCollection(content); |
122 | } catch (Exception e) { | 63 | } catch (Exception e) { |
123 | log.error("CollectionDeleteConsumer || UserCollection delete all error || {}", e.toString(), e); | 64 | log.error("CollectionDeleteConsumer || UserCollection delete all error || {}", e.toString(), e); |
... | @@ -132,7 +73,8 @@ public class WeiXinEventConsumer { | ... | @@ -132,7 +73,8 @@ public class WeiXinEventConsumer { |
132 | @RabbitHandler | 73 | @RabbitHandler |
133 | @RabbitListener(bindings = { | 74 | @RabbitListener(bindings = { |
134 | @QueueBinding(value = @Queue(value = RabbitMqConfig.GET_QR_CODE_QUEUE), | 75 | @QueueBinding(value = @Queue(value = RabbitMqConfig.GET_QR_CODE_QUEUE), |
135 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | 76 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
77 | containerFactory = "managementRabbitListenerContainerFactory") | ||
136 | public void getQrCode(String content) { | 78 | public void getQrCode(String content) { |
137 | try { | 79 | try { |
138 | log.info("receive get qrCode message, content {}", content); | 80 | log.info("receive get qrCode message, content {}", content); |
... | @@ -191,7 +133,8 @@ public class WeiXinEventConsumer { | ... | @@ -191,7 +133,8 @@ public class WeiXinEventConsumer { |
191 | @RabbitHandler | 133 | @RabbitHandler |
192 | @RabbitListener(bindings = { | 134 | @RabbitListener(bindings = { |
193 | @QueueBinding(value = @Queue(value = RabbitMqConfig.WEIXIN_SUBORUNSUB_QUEUE), | 135 | @QueueBinding(value = @Queue(value = RabbitMqConfig.WEIXIN_SUBORUNSUB_QUEUE), |
194 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | 136 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
137 | containerFactory = "managementRabbitListenerContainerFactory") | ||
195 | @Transactional | 138 | @Transactional |
196 | public void subOrUnSubEvent(String content) { | 139 | public void subOrUnSubEvent(String content) { |
197 | try { | 140 | try { |
... | @@ -237,7 +180,8 @@ public class WeiXinEventConsumer { | ... | @@ -237,7 +180,8 @@ public class WeiXinEventConsumer { |
237 | @RabbitHandler | 180 | @RabbitHandler |
238 | @RabbitListener(bindings = { | 181 | @RabbitListener(bindings = { |
239 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_ADD_QUEUE), | 182 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_ADD_QUEUE), |
240 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | 183 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
184 | containerFactory = "managementRabbitListenerContainerFactory") | ||
241 | @Transactional | 185 | @Transactional |
242 | public void addCollection(String content) { | 186 | public void addCollection(String content) { |
243 | try { | 187 | try { | ... | ... |
... | @@ -14,6 +14,8 @@ import org.springframework.stereotype.Component; | ... | @@ -14,6 +14,8 @@ import org.springframework.stereotype.Component; |
14 | import org.springframework.web.client.RestTemplate; | 14 | import org.springframework.web.client.RestTemplate; |
15 | 15 | ||
16 | import javax.annotation.PostConstruct; | 16 | import javax.annotation.PostConstruct; |
17 | import java.nio.charset.StandardCharsets; | ||
18 | import java.util.Base64; | ||
17 | import java.util.HashMap; | 19 | import java.util.HashMap; |
18 | 20 | ||
19 | @Slf4j | 21 | @Slf4j |
... | @@ -135,6 +137,9 @@ public class RestTemplateClient { | ... | @@ -135,6 +137,9 @@ public class RestTemplateClient { |
135 | 137 | ||
136 | public String addCollection(String content) { | 138 | public String addCollection(String content) { |
137 | String url = BASE_URL + "/ucEngine/api/userOperation/addCollection"; | 139 | String url = BASE_URL + "/ucEngine/api/userOperation/addCollection"; |
140 | //处理接口调用 中文不显示问题 | ||
141 | content = new String(Base64.getEncoder().encode(content.getBytes(StandardCharsets.UTF_8))); | ||
142 | |||
138 | restTemplate.postForEntity(url, content, String.class); | 143 | restTemplate.postForEntity(url, content, String.class); |
139 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | 144 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); |
140 | String entityBody = ""; | 145 | String entityBody = ""; | ... | ... |
-
Please register or sign in to post a comment