Merge branch '2.0.0-develop'
# Conflicts: # member-service-impl/src/main/java/com/topdraw/business/module/member/address/domain/MemberAddress.java # member-service-impl/src/main/java/com/topdraw/business/module/member/profile/domain/MemberProfileBuild.java # member-service-impl/src/main/java/com/topdraw/business/module/member/profile/service/dto/MemberProfileDTO.java # member-service-impl/src/main/java/com/topdraw/business/module/member/profile/service/impl/MemberProfileServiceImpl.java # member-service-impl/src/main/java/com/topdraw/business/module/member/rest/MemberController.java # member-service-impl/src/main/java/com/topdraw/business/module/member/service/MemberService.java # member-service-impl/src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java # member-service-impl/src/main/java/com/topdraw/business/module/member/viphistory/service/impl/MemberVipHistoryServiceImpl.java # member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/domain/UserTv.java # member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/service/dto/UserTvDTO.java # member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/service/dto/UserWeixinDTO.java # member-service-impl/src/main/java/com/topdraw/business/process/domian/TempIptvUser.java # member-service-impl/src/main/java/com/topdraw/business/process/rest/MemberOperationController.java # member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java # member-service-impl/src/main/java/com/topdraw/business/process/service/UserOperationService.java # member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java # member-service-impl/src/main/java/com/topdraw/business/process/service/impl/member/MemberOperationServiceImpl.java # member-service-impl/src/main/java/com/topdraw/resttemplate/RestTemplateClient.java # member-service-impl/src/main/resources/config/application-dev.yml # member-service-impl/src/test/java/com/topdraw/test/business/basicdata/member/profile/MemberProfileServiceTest.java # member-service-impl/src/test/java/com/topdraw/test/business/basicdata/member/rest/MemberControllerTest.java # member-service-impl/src/test/java/com/topdraw/test/business/basicdata/member/rest/MemberProfileControllerTest.java # member-service-impl/src/test/java/com/topdraw/test/business/process/rest/UserOperationControllerTest.java
Showing
333 changed files
with
1822 additions
and
1519 deletions
document/sql/structure/structure_03.14.sql
0 → 100644
1 | ALTER TABLE `uc_user_tv` | ||
2 | MODIFY COLUMN `platform_account` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '运营商平台账号' AFTER `id`, | ||
3 | MODIFY COLUMN `member_id` bigint(20) NULL DEFAULT NULL COMMENT '会员id' AFTER `platform_account`, | ||
4 | ADD COLUMN `vis_user_id` bigint(0) UNSIGNED NULL COMMENT 'vis_user表主键' AFTER `member_id`, | ||
5 | MODIFY COLUMN `priority_member_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主会员编码' AFTER `member_id`, | ||
6 | MODIFY COLUMN `platform` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '运营商平台' AFTER `image`, | ||
7 | MODIFY COLUMN `person_id` bigint(20) NULL DEFAULT NULL COMMENT '人ID' AFTER `update_time`, | ||
8 | ADD UNIQUE INDEX `unique_vis_user_id`(`vis_user_id`) USING BTREE; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -17,17 +17,18 @@ | ... | @@ -17,17 +17,18 @@ |
17 | 17 | ||
18 | <dependencies> | 18 | <dependencies> |
19 | <!--系统--> | 19 | <!--系统--> |
20 | <dependency> | 20 | <!--<dependency> |
21 | <groupId>com.topdraw</groupId> | 21 | <groupId>com.topdraw</groupId> |
22 | <artifactId>cronos-system</artifactId> | 22 | <artifactId>cronos-system</artifactId> |
23 | <version>${cronos.version}</version> | 23 | <version>${cronos.version}</version> |
24 | </dependency> | 24 | </dependency>--> |
25 | |||
25 | <!--代码生成器--> | 26 | <!--代码生成器--> |
26 | <dependency> | 27 | <!--<dependency> |
27 | <groupId>com.topdraw</groupId> | 28 | <groupId>com.topdraw</groupId> |
28 | <artifactId>cronos-generator</artifactId> | 29 | <artifactId>cronos-generator</artifactId> |
29 | <version>${cronos.version}</version> | 30 | <version>${cronos.version}</version> |
30 | </dependency> | 31 | </dependency>--> |
31 | </dependencies> | 32 | </dependencies> |
32 | 33 | ||
33 | </project> | 34 | </project> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -15,16 +15,27 @@ | ... | @@ -15,16 +15,27 @@ |
15 | <maven.compiler.source>8</maven.compiler.source> | 15 | <maven.compiler.source>8</maven.compiler.source> |
16 | <maven.compiler.target>8</maven.compiler.target> | 16 | <maven.compiler.target>8</maven.compiler.target> |
17 | <jjwt.version>0.9.1</jjwt.version> | 17 | <jjwt.version>0.9.1</jjwt.version> |
18 | <cronos.version>1.1.0</cronos.version> | ||
18 | </properties> | 19 | </properties> |
19 | 20 | ||
20 | 21 | ||
21 | <dependencies> | 22 | <dependencies> |
22 | 23 | ||
23 | <!--redisson--> | 24 | <!--<dependency> |
25 | <groupId>com.topdraw</groupId> | ||
26 | <artifactId>cronos-system</artifactId> | ||
27 | <version>${cronos.version}</version> | ||
28 | </dependency>--> | ||
29 | |||
24 | <dependency> | 30 | <dependency> |
25 | <groupId>org.redisson</groupId> | 31 | <groupId>com.topdraw</groupId> |
26 | <artifactId>redisson</artifactId> | 32 | <artifactId>code-generator</artifactId> |
27 | <version>3.16.3</version> | 33 | <version>3.1.0</version> |
34 | </dependency> | ||
35 | |||
36 | <dependency> | ||
37 | <groupId>org.springframework.boot</groupId> | ||
38 | <artifactId>spring-boot-starter-cache</artifactId> | ||
28 | </dependency> | 39 | </dependency> |
29 | 40 | ||
30 | <!--api--> | 41 | <!--api--> | ... | ... |
... | @@ -9,6 +9,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder; | ... | @@ -9,6 +9,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder; |
9 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 9 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
10 | import org.springframework.cache.annotation.EnableCaching; | 10 | import org.springframework.cache.annotation.EnableCaching; |
11 | import org.springframework.context.annotation.Bean; | 11 | import org.springframework.context.annotation.Bean; |
12 | import org.springframework.context.annotation.EnableAspectJAutoProxy; | ||
12 | import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | 13 | import org.springframework.data.jpa.repository.config.EnableJpaAuditing; |
13 | import org.springframework.retry.annotation.EnableRetry; | 14 | import org.springframework.retry.annotation.EnableRetry; |
14 | import org.springframework.scheduling.annotation.EnableAsync; | 15 | import org.springframework.scheduling.annotation.EnableAsync; |
... | @@ -24,6 +25,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; | ... | @@ -24,6 +25,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; |
24 | @EnableRetry | 25 | @EnableRetry |
25 | @EnableCaching | 26 | @EnableCaching |
26 | @SpringBootApplication(exclude = {SecurityAutoConfiguration.class}) | 27 | @SpringBootApplication(exclude = {SecurityAutoConfiguration.class}) |
28 | @EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true) | ||
27 | public class MemberServiceApplication extends SpringBootServletInitializer { | 29 | public class MemberServiceApplication extends SpringBootServletInitializer { |
28 | 30 | ||
29 | public static void main(String[] args) { | 31 | public static void main(String[] args) { | ... | ... |
... | @@ -2,6 +2,8 @@ package com.topdraw.aspect; | ... | @@ -2,6 +2,8 @@ package com.topdraw.aspect; |
2 | 2 | ||
3 | 3 | ||
4 | import com.alibaba.fastjson.JSON; | 4 | import com.alibaba.fastjson.JSON; |
5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
6 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
5 | import com.topdraw.mq.domain.TableOperationMsg; | 7 | import com.topdraw.mq.domain.TableOperationMsg; |
6 | import com.topdraw.mq.producer.MessageProducer; | 8 | import com.topdraw.mq.producer.MessageProducer; |
7 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; | ... | ... |
... | @@ -2,12 +2,8 @@ package com.topdraw.business.module.common.domain; | ... | @@ -2,12 +2,8 @@ package com.topdraw.business.module.common.domain; |
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | import lombok.experimental.Accessors; | 4 | import lombok.experimental.Accessors; |
5 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
6 | 5 | ||
7 | import javax.persistence.Entity; | ||
8 | import javax.persistence.EntityListeners; | ||
9 | import javax.persistence.Transient; | 6 | import javax.persistence.Transient; |
10 | import java.io.Serializable; | ||
11 | 7 | ||
12 | /** | 8 | /** |
13 | * @author : | 9 | * @author : |
... | @@ -20,9 +16,12 @@ import java.io.Serializable; | ... | @@ -20,9 +16,12 @@ import java.io.Serializable; |
20 | */ | 16 | */ |
21 | @Data | 17 | @Data |
22 | @Accessors(chain = true) | 18 | @Accessors(chain = true) |
23 | public class DefaultAsyncMqModule { | 19 | public class AsyncMqModule { |
24 | 20 | ||
25 | @Transient | 21 | @Transient |
26 | private String memberCode; | 22 | private String memberCode; |
27 | 23 | ||
24 | /** 运营商平台账号 */ | ||
25 | @Transient | ||
26 | private String platformAccount; | ||
28 | } | 27 | } | ... | ... |
1 | package com.topdraw.business.module.points.standingbook.domain; | 1 | package com.topdraw.business.module.contact.vis.domain; |
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | import lombok.experimental.Accessors; | 4 | import lombok.experimental.Accessors; |
... | @@ -14,52 +14,60 @@ import java.io.Serializable; | ... | @@ -14,52 +14,60 @@ import java.io.Serializable; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * @author XiangHan | 16 | * @author XiangHan |
17 | * @date 2021-10-29 | 17 | * @date 2022-04-24 |
18 | */ | 18 | */ |
19 | @Entity | 19 | @Entity |
20 | @Data | 20 | @Data |
21 | @EntityListeners(AuditingEntityListener.class) | 21 | @EntityListeners(AuditingEntityListener.class) |
22 | @Accessors(chain = true) | 22 | @Accessors(chain = true) |
23 | @Table(name="uc_points_standing_book") | 23 | @Table(name="x_activity_address") |
24 | public class PointsStandingBook implements Serializable { | 24 | public class ActivityAddress implements Serializable { |
25 | 25 | ||
26 | // 主键 | 26 | // id |
27 | @Id | 27 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 29 | @Column(name = "id") |
30 | private Long id; | 30 | private Long id; |
31 | 31 | ||
32 | // 积分生产 | 32 | // vis的用户id |
33 | @Column(name = "points_produce", nullable = false) | 33 | @Column(name = "user_id", nullable = false) |
34 | private Long pointsProduce; | 34 | private Long userId; |
35 | 35 | ||
36 | // 积分消耗 | 36 | // 大屏账号 |
37 | @Column(name = "points_consume", nullable = false) | 37 | @Column(name = "platform_account") |
38 | private Long pointsConsume; | 38 | private String platformAccount; |
39 | 39 | ||
40 | // 可用总积分 | 40 | // 活动id |
41 | @Column(name = "points_available", nullable = false) | 41 | @Column(name = "activity_id", nullable = false) |
42 | private Long pointsAvailable; | 42 | private Long activityId; |
43 | 43 | ||
44 | // 积分过期 | 44 | // 应用id |
45 | @Column(name = "points_expire", nullable = false) | 45 | @Column(name = "app_id") |
46 | private Long pointsExpire; | 46 | private Long appId; |
47 | 47 | ||
48 | // 日期 | 48 | // 收货人名称 |
49 | @Column(name = "day") | 49 | @Column(name = "name") |
50 | private String day; | 50 | private String name; |
51 | |||
52 | // 收货人地址 | ||
53 | @Column(name = "address") | ||
54 | private String address; | ||
55 | |||
56 | // 收获人手机号 | ||
57 | @Column(name = "cellphone") | ||
58 | private String cellphone; | ||
51 | 59 | ||
52 | // 创建时间 | 60 | // 创建时间 |
53 | @CreatedDate | 61 | @CreatedDate |
54 | @Column(name = "create_time") | 62 | @Column(name = "create_time") |
55 | private Timestamp createTime; | 63 | private Timestamp createTime; |
56 | 64 | ||
57 | // 创建时间 | 65 | // 更新时间 |
58 | @LastModifiedDate | 66 | @LastModifiedDate |
59 | @Column(name = "update_time") | 67 | @Column(name = "update_time") |
60 | private Timestamp updateTime; | 68 | private Timestamp updateTime; |
61 | 69 | ||
62 | public void copy(PointsStandingBook source){ | 70 | public void copy(ActivityAddress source){ |
63 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | 71 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
64 | } | 72 | } |
65 | } | 73 | } | ... | ... |
1 | package com.topdraw.business.module.contact.vis.repository; | ||
2 | |||
3 | import com.topdraw.business.module.contact.vis.domain.ActivityAddress; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | import java.util.List; | ||
8 | import java.util.Optional; | ||
9 | |||
10 | /** | ||
11 | * @author XiangHan | ||
12 | * @date 2022-04-24 | ||
13 | */ | ||
14 | public interface ActivityAddressRepository extends JpaRepository<ActivityAddress, Long>, JpaSpecificationExecutor<ActivityAddress> { | ||
15 | |||
16 | List<ActivityAddress> findByPlatformAccount(String platformAccount); | ||
17 | |||
18 | Optional<ActivityAddress> findByPlatformAccountAndActivityId(String platformAccount, Long activityId); | ||
19 | } |
1 | package com.topdraw.business.module.contact.vis.rest; | ||
2 | |||
3 | import com.topdraw.annotation.AnonymousAccess; | ||
4 | import com.topdraw.business.module.contact.vis.service.dto.ActivityAddressDTO; | ||
5 | import com.topdraw.common.ResultInfo; | ||
6 | import com.topdraw.business.module.contact.vis.domain.ActivityAddress; | ||
7 | import com.topdraw.business.module.contact.vis.service.ActivityAddressService; | ||
8 | import com.topdraw.exception.BadRequestException; | ||
9 | import lombok.extern.slf4j.Slf4j; | ||
10 | import org.apache.commons.lang3.StringUtils; | ||
11 | import org.springframework.beans.factory.annotation.Autowired; | ||
12 | import org.springframework.util.Assert; | ||
13 | import org.springframework.validation.annotation.Validated; | ||
14 | import org.springframework.web.bind.annotation.*; | ||
15 | import io.swagger.annotations.*; | ||
16 | |||
17 | import java.util.List; | ||
18 | import java.util.Objects; | ||
19 | |||
20 | /** | ||
21 | * @author XiangHan | ||
22 | * @date 2022-04-24 | ||
23 | */ | ||
24 | @Api(tags = "中奖人联系方式管理") | ||
25 | @RestController | ||
26 | @RequestMapping("/uce/activityAddress") | ||
27 | @Slf4j | ||
28 | public class ActivityAddressController { | ||
29 | |||
30 | @Autowired | ||
31 | private ActivityAddressService activityAddressService; | ||
32 | |||
33 | @GetMapping(value = "/findByPlatformAccountAndActivityId") | ||
34 | @ApiOperation("查询指定活动事件的中奖人联系方式") | ||
35 | @AnonymousAccess | ||
36 | public ResultInfo findByPlatformAccountAndActivityId(@RequestParam(value = "platformAccount") String platformAccount, | ||
37 | @RequestParam(value = "activityId") Long activityId) { | ||
38 | log.info("activityAddress ==>> findByPlatformAccountAndActivityId ==>> platformAccount ==>> {}", platformAccount); | ||
39 | log.info("activityAddress ==>> findByPlatformAccountAndActivityId ==>> activityId ==>> {}", activityId); | ||
40 | if (StringUtils.isBlank(platformAccount)) { | ||
41 | throw new BadRequestException("platformAccount is nul"); | ||
42 | } | ||
43 | |||
44 | if (Objects.isNull(activityId)) { | ||
45 | throw new BadRequestException("activityId is nul"); | ||
46 | } | ||
47 | |||
48 | ActivityAddress activityAddress = new ActivityAddress(); | ||
49 | activityAddress.setPlatformAccount(platformAccount); | ||
50 | activityAddress.setActivityId(activityId); | ||
51 | ActivityAddressDTO activityAddressDTO = this.activityAddressService.findByPlatformAccountAndActivityId(activityAddress); | ||
52 | return ResultInfo.success(activityAddressDTO); | ||
53 | } | ||
54 | |||
55 | @GetMapping(value = "/findByPlatformAccount") | ||
56 | @ApiOperation("查询所有ActivityAddress") | ||
57 | @AnonymousAccess | ||
58 | public ResultInfo findByPlatformAccount(@RequestParam(value = "platformAccount") String platformAccount) { | ||
59 | log.info("activityAddress ==>> findByPlatformAccount ==>> platformAccount ==>> {}", platformAccount); | ||
60 | List<ActivityAddressDTO> activityAddressDTO = this.activityAddressService.findByPlatformAccount(platformAccount); | ||
61 | return ResultInfo.success(activityAddressDTO); | ||
62 | } | ||
63 | |||
64 | @PostMapping(value = "/createOrUpdateActivityAddress") | ||
65 | @ApiOperation("新增ActivityAddress") | ||
66 | @AnonymousAccess | ||
67 | public ResultInfo createOrUpdateActivityAddress(@Validated @RequestBody ActivityAddress resources) { | ||
68 | log.info("activityAddress ==>> createOrUpdateActivityAddress ==>> params ==>> {}", resources); | ||
69 | String platformAccount = resources.getPlatformAccount(); | ||
70 | if (StringUtils.isBlank(platformAccount)) { | ||
71 | throw new BadRequestException("platformAccount is null"); | ||
72 | } | ||
73 | Long appId = resources.getAppId(); | ||
74 | if (Objects.isNull(appId)) { | ||
75 | throw new BadRequestException("appId is null"); | ||
76 | } | ||
77 | Long activityId = resources.getActivityId(); | ||
78 | if (Objects.isNull(activityId)) { | ||
79 | throw new BadRequestException("activityId is null"); | ||
80 | } | ||
81 | Long userId = resources.getUserId(); | ||
82 | if (Objects.isNull(userId)) { | ||
83 | throw new BadRequestException("visUserId is null"); | ||
84 | } | ||
85 | String name = resources.getName(); | ||
86 | if (StringUtils.isBlank(name)) { | ||
87 | throw new BadRequestException("name is null"); | ||
88 | } | ||
89 | String cellphone = resources.getCellphone(); | ||
90 | if (StringUtils.isBlank(cellphone)) { | ||
91 | throw new BadRequestException("cellphone is null"); | ||
92 | } | ||
93 | String address = resources.getAddress(); | ||
94 | if (StringUtils.isBlank(address)) { | ||
95 | throw new BadRequestException( "address is null"); | ||
96 | } | ||
97 | ActivityAddressDTO activityAddressDTO = this.activityAddressService.createOrUpdateActivityAddress(resources); | ||
98 | return ResultInfo.success(activityAddressDTO); | ||
99 | } | ||
100 | |||
101 | // @Log | ||
102 | @PostMapping(value = "/create") | ||
103 | @ApiOperation("新增ActivityAddress") | ||
104 | @AnonymousAccess | ||
105 | public ResultInfo create(@Validated @RequestBody ActivityAddress resources) { | ||
106 | this.activityAddressService.create(resources); | ||
107 | return ResultInfo.success(); | ||
108 | } | ||
109 | |||
110 | // @Log | ||
111 | @PutMapping(value = "/update") | ||
112 | @ApiOperation("修改ActivityAddress") | ||
113 | @AnonymousAccess | ||
114 | public ResultInfo update(@Validated @RequestBody ActivityAddress resources) { | ||
115 | this.activityAddressService.update(resources); | ||
116 | return ResultInfo.success(); | ||
117 | } | ||
118 | |||
119 | |||
120 | // @Log | ||
121 | @DeleteMapping(value = "/{id}") | ||
122 | @ApiOperation("删除ActivityAddress") | ||
123 | public ResultInfo delete(@PathVariable Long id) { | ||
124 | this.activityAddressService.delete(id); | ||
125 | return ResultInfo.success(); | ||
126 | } | ||
127 | |||
128 | } |
1 | package com.topdraw.business.module.contact.vis.service; | ||
2 | |||
3 | import com.topdraw.business.module.contact.vis.domain.ActivityAddress; | ||
4 | import com.topdraw.business.module.contact.vis.service.dto.ActivityAddressDTO; | ||
5 | |||
6 | import java.util.List; | ||
7 | |||
8 | /** | ||
9 | * @author XiangHan | ||
10 | * @date 2022-04-24 | ||
11 | */ | ||
12 | public interface ActivityAddressService { | ||
13 | /** | ||
14 | * 根据ID查询 | ||
15 | * @param id ID | ||
16 | * @return ActivityAddressDTO | ||
17 | */ | ||
18 | ActivityAddressDTO findById(Long id); | ||
19 | |||
20 | /** | ||
21 | * | ||
22 | * @param resources | ||
23 | */ | ||
24 | ActivityAddressDTO create(ActivityAddress resources); | ||
25 | |||
26 | /** | ||
27 | * | ||
28 | * @param resources | ||
29 | */ | ||
30 | ActivityAddressDTO update(ActivityAddress resources); | ||
31 | |||
32 | /** | ||
33 | * | ||
34 | * @param id | ||
35 | */ | ||
36 | void delete(Long id); | ||
37 | |||
38 | /** | ||
39 | * | ||
40 | * @param platformAccount | ||
41 | * @return | ||
42 | */ | ||
43 | List<ActivityAddressDTO> findByPlatformAccount(String platformAccount); | ||
44 | |||
45 | /** | ||
46 | * | ||
47 | * @param resources | ||
48 | * @return | ||
49 | */ | ||
50 | ActivityAddressDTO createOrUpdateActivityAddress(ActivityAddress resources); | ||
51 | |||
52 | /** | ||
53 | * | ||
54 | * @param resources | ||
55 | * @return | ||
56 | */ | ||
57 | ActivityAddressDTO findByPlatformAccountAndActivityId(ActivityAddress resources); | ||
58 | } |
1 | package com.topdraw.business.module.contact.vis.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 2022-04-24 | ||
11 | */ | ||
12 | @Data | ||
13 | public class ActivityAddressDTO implements Serializable { | ||
14 | |||
15 | // id | ||
16 | private Long id; | ||
17 | |||
18 | // vis的用户id | ||
19 | private Long userId; | ||
20 | |||
21 | // 大屏账号 | ||
22 | private String platformAccount; | ||
23 | |||
24 | // 活动id | ||
25 | private Long activityId; | ||
26 | |||
27 | // 应用id | ||
28 | private Long appId; | ||
29 | |||
30 | // 收货人名称 | ||
31 | private String name; | ||
32 | |||
33 | // 收货人地址 | ||
34 | private String address; | ||
35 | |||
36 | // 收获人手机号 | ||
37 | private String cellphone; | ||
38 | |||
39 | // 创建时间 | ||
40 | private Timestamp createTime; | ||
41 | |||
42 | // 更新时间 | ||
43 | private Timestamp updateTime; | ||
44 | } |
1 | package com.topdraw.business.module.contact.vis.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.contact.vis.domain.ActivityAddress; | ||
4 | import com.topdraw.util.TimestampUtil; | ||
5 | import com.topdraw.utils.ValidationUtil; | ||
6 | import com.topdraw.business.module.contact.vis.repository.ActivityAddressRepository; | ||
7 | import com.topdraw.business.module.contact.vis.service.ActivityAddressService; | ||
8 | import com.topdraw.business.module.contact.vis.service.dto.ActivityAddressDTO; | ||
9 | import com.topdraw.business.module.contact.vis.service.mapper.ActivityAddressMapper; | ||
10 | import org.springframework.beans.factory.annotation.Autowired; | ||
11 | import org.springframework.cache.annotation.CachePut; | ||
12 | import org.springframework.cache.annotation.Cacheable; | ||
13 | import org.springframework.stereotype.Service; | ||
14 | import org.springframework.transaction.annotation.Propagation; | ||
15 | import org.springframework.transaction.annotation.Transactional; | ||
16 | import org.springframework.dao.EmptyResultDataAccessException; | ||
17 | import org.springframework.util.Assert; | ||
18 | |||
19 | import java.util.List; | ||
20 | import java.util.Objects; | ||
21 | |||
22 | /** | ||
23 | * @author XiangHan | ||
24 | * @date 2022-04-24 | ||
25 | */ | ||
26 | @Service | ||
27 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
28 | public class ActivityAddressServiceImpl implements ActivityAddressService { | ||
29 | |||
30 | @Autowired | ||
31 | private ActivityAddressRepository activityAddressRepository; | ||
32 | |||
33 | @Autowired | ||
34 | private ActivityAddressMapper activityAddressMapper; | ||
35 | |||
36 | @Override | ||
37 | // @Cacheable(cacheNames = "uce::activityAddress::platformAccount", key = "#platformAccount") | ||
38 | public List<ActivityAddressDTO> findByPlatformAccount(String platformAccount) { | ||
39 | List<ActivityAddress> activityAddress = activityAddressRepository.findByPlatformAccount(platformAccount); | ||
40 | return this.activityAddressMapper.toDto(activityAddress); | ||
41 | } | ||
42 | |||
43 | @Override | ||
44 | public ActivityAddressDTO createOrUpdateActivityAddress(ActivityAddress resources) { | ||
45 | ActivityAddressDTO activityAddressDTO = this.findByPlatformAccountAndActivityId(resources); | ||
46 | if (Objects.isNull(activityAddressDTO.getId())) { | ||
47 | activityAddressDTO = this.create(resources); | ||
48 | } else { | ||
49 | resources.setId(activityAddressDTO.getId()); | ||
50 | resources.setUpdateTime(TimestampUtil.now()); | ||
51 | activityAddressDTO = this.update(resources); | ||
52 | } | ||
53 | return activityAddressDTO; | ||
54 | } | ||
55 | |||
56 | @Override | ||
57 | public ActivityAddressDTO findByPlatformAccountAndActivityId(ActivityAddress resources) { | ||
58 | String platformAccount = resources.getPlatformAccount(); | ||
59 | Long activityId = resources.getActivityId(); | ||
60 | ActivityAddress activityAddress = activityAddressRepository.findByPlatformAccountAndActivityId(platformAccount, activityId).orElseGet(ActivityAddress::new); | ||
61 | return this.activityAddressMapper.toDto(activityAddress); | ||
62 | } | ||
63 | |||
64 | @Override | ||
65 | public ActivityAddressDTO findById(Long id) { | ||
66 | ActivityAddress ActivityAddress = activityAddressRepository.findById(id).orElseGet(ActivityAddress::new); | ||
67 | ValidationUtil.isNull(ActivityAddress.getId(),"ActivityAddress","id",id); | ||
68 | return this.activityAddressMapper.toDto(ActivityAddress); | ||
69 | } | ||
70 | |||
71 | @Override | ||
72 | @Transactional(rollbackFor = Exception.class) | ||
73 | // @CachePut(cacheNames = "uce::activityAddress::platformAccount", key = "#resources.platformAccount") | ||
74 | public ActivityAddressDTO create(ActivityAddress resources) { | ||
75 | ActivityAddress activityAddress = activityAddressRepository.save(resources); | ||
76 | return this.activityAddressMapper.toDto(activityAddress); | ||
77 | } | ||
78 | |||
79 | @Override | ||
80 | @Transactional(rollbackFor = Exception.class) | ||
81 | // @CachePut(cacheNames = "uce::activityAddress::platformAccount", key = "#resources.platformAccount") | ||
82 | public ActivityAddressDTO update(ActivityAddress resources) { | ||
83 | ActivityAddress activityAddress = activityAddressRepository.findById(resources.getId()).orElseGet(ActivityAddress::new); | ||
84 | ValidationUtil.isNull( activityAddress.getId(),"ActivityAddress","id",resources.getId()); | ||
85 | activityAddress.copy(resources); | ||
86 | ActivityAddress save = activityAddressRepository.save(activityAddress); | ||
87 | return this.activityAddressMapper.toDto(save); | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | @Transactional(rollbackFor = Exception.class) | ||
92 | public void delete(Long id) { | ||
93 | Assert.notNull(id, "The given id must not be null!"); | ||
94 | ActivityAddress ActivityAddress = activityAddressRepository.findById(id).orElseThrow( | ||
95 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ActivityAddress.class, id), 1)); | ||
96 | activityAddressRepository.delete(ActivityAddress); | ||
97 | } | ||
98 | |||
99 | |||
100 | |||
101 | |||
102 | } |
1 | package com.topdraw.business.module.points.standingbook.service.mapper; | 1 | package com.topdraw.business.module.contact.vis.service.mapper; |
2 | 2 | ||
3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
4 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; | 4 | import com.topdraw.business.module.contact.vis.domain.ActivityAddress; |
5 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO; | 5 | import com.topdraw.business.module.contact.vis.service.dto.ActivityAddressDTO; |
6 | import org.mapstruct.Mapper; | 6 | import org.mapstruct.Mapper; |
7 | import org.mapstruct.ReportingPolicy; | 7 | import org.mapstruct.ReportingPolicy; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * @author XiangHan | 10 | * @author XiangHan |
11 | * @date 2021-10-29 | 11 | * @date 2022-04-24 |
12 | */ | 12 | */ |
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
14 | public interface PointsStandingBookMapper extends BaseMapper<PointsStandingBookDTO, PointsStandingBook> { | 14 | public interface ActivityAddressMapper extends BaseMapper<ActivityAddressDTO, ActivityAddress> { |
15 | 15 | ||
16 | } | 16 | } | ... | ... |
... | @@ -12,7 +12,6 @@ import java.sql.Timestamp; | ... | @@ -12,7 +12,6 @@ import java.sql.Timestamp; |
12 | import java.math.BigDecimal; | 12 | import java.math.BigDecimal; |
13 | 13 | ||
14 | import java.io.Serializable; | 14 | import java.io.Serializable; |
15 | import java.time.LocalDateTime; | ||
16 | 15 | ||
17 | /** | 16 | /** |
18 | * @author XiangHan | 17 | * @author XiangHan |
... | @@ -25,94 +24,94 @@ import java.time.LocalDateTime; | ... | @@ -25,94 +24,94 @@ import java.time.LocalDateTime; |
25 | @Table(name="m_coupon") | 24 | @Table(name="m_coupon") |
26 | public class Coupon implements Serializable { | 25 | public class Coupon implements Serializable { |
27 | 26 | ||
28 | // id | 27 | /** id */ |
29 | @Id | 28 | @Id |
30 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
31 | @Column(name = "id") | 30 | @Column(name = "id") |
32 | private Long id; | 31 | private Long id; |
33 | 32 | ||
34 | // 标识 | 33 | /** 标识 */ |
35 | @Column(name = "code", nullable = false) | 34 | @Column(name = "code", nullable = false) |
36 | private String code; | 35 | private String code; |
37 | 36 | ||
38 | // 名称 | 37 | /** 名称 */ |
39 | @Column(name = "title", nullable = false) | 38 | @Column(name = "title", nullable = false) |
40 | private String title; | 39 | private String title; |
41 | 40 | ||
42 | // 图片 | 41 | /** 图片 */ |
43 | @Column(name = "images") | 42 | @Column(name = "images") |
44 | private String images; | 43 | private String images; |
45 | 44 | ||
46 | // 发行量,-1代表不限量 | 45 | /** 发行量,-1代表不限量 */ |
47 | @Column(name = "stock") | 46 | @Column(name = "stock") |
48 | private Integer stock; | 47 | private Integer stock; |
49 | 48 | ||
50 | // 剩余量,-1代表不限量 | 49 | /** 剩余量,-1代表不限量 */ |
51 | @Column(name = "remain_stock") | 50 | @Column(name = "remain_stock") |
52 | private Integer remainStock; | 51 | private Integer remainStock; |
53 | 52 | ||
54 | // 优惠形式:1:现金;2:折扣 | 53 | /** 优惠形式:1:现金;2:折扣 */ |
55 | @Column(name = "use_type") | 54 | @Column(name = "use_type") |
56 | private Integer useType; | 55 | private Integer useType; |
57 | 56 | ||
58 | // 面额 | 57 | /** 面额 */ |
59 | @Column(name = "denomination") | 58 | @Column(name = "denomination") |
60 | private BigDecimal denomination; | 59 | private BigDecimal denomination; |
61 | 60 | ||
62 | // 折扣 | 61 | /** 折扣 */ |
63 | @Column(name = "discount") | 62 | @Column(name = "discount") |
64 | private BigDecimal discount; | 63 | private BigDecimal discount; |
65 | 64 | ||
66 | // 适用用户范围:1:新用户;2:全体用户 | 65 | /** 适用用户范围:1:新用户;2:全体用户 */ |
67 | @Column(name = "user_range") | 66 | @Column(name = "user_range") |
68 | private Integer userRange; | 67 | private Integer userRange; |
69 | 68 | ||
70 | // 限领次数 -1:无限次; >0:具体次数 | 69 | /** 限领次数 -1:无限次; >0:具体次数 */ |
71 | @Column(name = "collect_limit") | 70 | @Column(name = "collect_limit") |
72 | private Integer collectLimit; | 71 | private Integer collectLimit; |
73 | 72 | ||
74 | // 适用门槛:1:无门槛;2:满减形式 | 73 | /** 适用门槛:1:无门槛;2:满减形式 */ |
75 | @Column(name = "threshold_type") | 74 | @Column(name = "threshold_type") |
76 | private Integer thresholdType; | 75 | private Integer thresholdType; |
77 | 76 | ||
78 | // 满减门槛 | 77 | /** 满减门槛 */ |
79 | @Column(name = "amount_threshold") | 78 | @Column(name = "amount_threshold") |
80 | private BigDecimal amountThreshold; | 79 | private BigDecimal amountThreshold; |
81 | 80 | ||
82 | // 产品范围:1:全部商品;2:指定商品 | 81 | /** 产品范围:1:全部商品;2:指定商品 */ |
83 | @Column(name = "item_range") | 82 | @Column(name = "item_range") |
84 | private Integer itemRange; | 83 | private Integer itemRange; |
85 | 84 | ||
86 | // 生效形式:1:固定日期;2:相对日期 | 85 | /** 生效形式:1:固定日期;2:相对日期 */ |
87 | @Column(name = "effect_type") | 86 | @Column(name = "effect_type") |
88 | private Integer effectType; | 87 | private Integer effectType; |
89 | 88 | ||
90 | // 生效时间 | 89 | /** 生效时间 */ |
91 | @Column(name = "start_time") | 90 | @Column(name = "start_time") |
92 | private Timestamp startTime; | 91 | private Timestamp startTime; |
93 | 92 | ||
94 | // 过期时间 | 93 | /** 过期时间 */ |
95 | @Column(name = "expire_time") | 94 | @Column(name = "expire_time") |
96 | private LocalDateTime expireTime; | 95 | private Timestamp expireTime; |
97 | 96 | ||
98 | // 自领取当日,几天内有效 | 97 | /** 自领取当日,几天内有效 */ |
99 | @Column(name = "valid_days") | 98 | @Column(name = "valid_days") |
100 | private Integer validDays; | 99 | private Integer validDays; |
101 | 100 | ||
102 | // 使用说明 | 101 | /** 使用说明 */ |
103 | @Column(name = "description") | 102 | @Column(name = "description") |
104 | private String description; | 103 | private String description; |
105 | 104 | ||
106 | // 状态0:未开始,1:启用;2:停用 | 105 | /** 状态0:未开始,1:启用;2:停用 */ |
107 | @Column(name = "status") | 106 | @Column(name = "status") |
108 | private Integer status; | 107 | private Integer status; |
109 | 108 | ||
110 | // 创建时间 | 109 | /** 创建时间 */ |
111 | @CreatedDate | 110 | @CreatedDate |
112 | @Column(name = "create_time") | 111 | @Column(name = "create_time") |
113 | private Timestamp createTime; | 112 | private Timestamp createTime; |
114 | 113 | ||
115 | // 更新时间 | 114 | /** 更新时间 */ |
116 | @LastModifiedDate | 115 | @LastModifiedDate |
117 | @Column(name = "update_time") | 116 | @Column(name = "update_time") |
118 | private Timestamp updateTime; | 117 | private Timestamp updateTime; | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/coupon/domain/CouponBuilder.java
0 → 100644
1 | package com.topdraw.business.module.coupon.domain; | ||
2 | |||
3 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; | ||
4 | import com.topdraw.util.IdWorker; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.beans.BeanUtils; | ||
7 | |||
8 | import java.math.BigDecimal; | ||
9 | import java.sql.Timestamp; | ||
10 | import java.util.Objects; | ||
11 | |||
12 | /** | ||
13 | * 优惠券 | ||
14 | */ | ||
15 | public class CouponBuilder { | ||
16 | |||
17 | public static Coupon build(CouponDTO couponDTO){ | ||
18 | Coupon coupon = new Coupon(); | ||
19 | BeanUtils.copyProperties(couponDTO,coupon); | ||
20 | return build(coupon.getId(), | ||
21 | coupon.getCode(), | ||
22 | coupon.getTitle(),coupon.getImages(),coupon.getStock(),coupon.getRemainStock(),coupon.getUseType(), | ||
23 | coupon.getDenomination(),coupon.getDiscount(),coupon.getUserRange(),coupon.getCollectLimit(), | ||
24 | coupon.getThresholdType(),coupon.getAmountThreshold(),coupon.getItemRange(),coupon.getEffectType(), | ||
25 | coupon.getStartTime(),coupon.getExpireTime(),coupon.getValidDays(),coupon.getDescription(),coupon.getStatus()); | ||
26 | } | ||
27 | |||
28 | public static Coupon build(Coupon coupon){ | ||
29 | return build(coupon.getId(), | ||
30 | coupon.getCode(), | ||
31 | coupon.getTitle(),coupon.getImages(),coupon.getStock(),coupon.getRemainStock(),coupon.getUseType(), | ||
32 | coupon.getDenomination(),coupon.getDiscount(),coupon.getUserRange(),coupon.getCollectLimit(), | ||
33 | coupon.getThresholdType(),coupon.getAmountThreshold(),coupon.getItemRange(),coupon.getEffectType(), | ||
34 | coupon.getStartTime(),coupon.getExpireTime(),coupon.getValidDays(),coupon.getDescription(),coupon.getStatus()); | ||
35 | } | ||
36 | |||
37 | public static Coupon build(Long id , String code , String title, | ||
38 | String images, | ||
39 | Integer stock, | ||
40 | Integer remainStock, | ||
41 | Integer useType, | ||
42 | BigDecimal denomination, | ||
43 | BigDecimal discount, | ||
44 | Integer userRange, | ||
45 | Integer collectLimit, | ||
46 | Integer thresholdType, | ||
47 | BigDecimal amountThreshold, | ||
48 | Integer itemRange, | ||
49 | Integer effectType, | ||
50 | Timestamp startTime, | ||
51 | Timestamp expireTime, | ||
52 | Integer validDays,String description , Integer status){ | ||
53 | |||
54 | Coupon coupon = new Coupon(); | ||
55 | coupon.setId(id); | ||
56 | coupon.setCode(StringUtils.isBlank(code)? IdWorker.generatorCode("coupon"):code); | ||
57 | coupon.setTitle(StringUtils.isBlank(title)?null:title); | ||
58 | coupon.setImages(StringUtils.isBlank(images)?null:images); | ||
59 | coupon.setStock(Objects.isNull(stock)?null:stock); | ||
60 | coupon.setRemainStock(Objects.isNull(remainStock)?null:remainStock); | ||
61 | coupon.setUseType(Objects.isNull(useType)?null:useType); | ||
62 | coupon.setDenomination(Objects.isNull(denomination)?null:denomination); | ||
63 | coupon.setDiscount(Objects.isNull(discount)?null:discount); | ||
64 | coupon.setUserRange(Objects.isNull(userRange)?null:userRange); | ||
65 | coupon.setCollectLimit(collectLimit); | ||
66 | coupon.setThresholdType(Objects.isNull(thresholdType)?null:thresholdType); | ||
67 | coupon.setAmountThreshold(Objects.isNull(amountThreshold)?null:amountThreshold); | ||
68 | coupon.setItemRange(Objects.isNull(itemRange)?null:itemRange); | ||
69 | coupon.setEffectType(Objects.isNull(effectType)?null:effectType); | ||
70 | coupon.setStartTime(Objects.isNull(startTime)?null: startTime); | ||
71 | coupon.setExpireTime(Objects.isNull(expireTime)?null:expireTime); | ||
72 | coupon.setValidDays(validDays); | ||
73 | coupon.setDescription(StringUtils.isBlank(description)?"":description); | ||
74 | coupon.setStatus(Objects.nonNull(status)?status:0); | ||
75 | return coupon; | ||
76 | } | ||
77 | |||
78 | } |
... | @@ -11,7 +11,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ... | @@ -11,7 +11,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
11 | import java.sql.Timestamp; | 11 | import java.sql.Timestamp; |
12 | 12 | ||
13 | import java.io.Serializable; | 13 | import java.io.Serializable; |
14 | import java.time.LocalDateTime; | ||
15 | 14 | ||
16 | /** | 15 | /** |
17 | * @author XiangHan | 16 | * @author XiangHan |
... | @@ -24,57 +23,60 @@ import java.time.LocalDateTime; | ... | @@ -24,57 +23,60 @@ import java.time.LocalDateTime; |
24 | @Table(name="m_coupon_history") | 23 | @Table(name="m_coupon_history") |
25 | public class CouponHistory implements Serializable { | 24 | public class CouponHistory implements Serializable { |
26 | 25 | ||
27 | // 主键 | 26 | @Transient |
27 | private String memberCode; | ||
28 | |||
29 | /** 主键 */ | ||
28 | @Id | 30 | @Id |
29 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 31 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
30 | @Column(name = "id") | 32 | @Column(name = "id") |
31 | private Long id; | 33 | private Long id; |
32 | 34 | ||
33 | // 优惠券id | 35 | /** 优惠券id */ |
34 | @Column(name = "coupon_id") | 36 | @Column(name = "coupon_id") |
35 | private Long couponId; | 37 | private Long couponId; |
36 | 38 | ||
37 | // 领券用户id(对应账号) | 39 | /** 领券用户id(对应账号) */ |
38 | @Column(name = "user_id") | 40 | @Column(name = "user_id") |
39 | private Long userId; | 41 | private Long userId; |
40 | 42 | ||
41 | // 优惠券code | 43 | /** 优惠券code */ |
42 | @Column(name = "coupon_code") | 44 | @Column(name = "coupon_code") |
43 | private String couponCode; | 45 | private String couponCode; |
44 | 46 | ||
45 | // 领取人昵称 | 47 | /** 领取人昵称 */ |
46 | @Column(name = "user_nickname") | 48 | @Column(name = "user_nickname") |
47 | private String userNickname; | 49 | private String userNickname; |
48 | 50 | ||
49 | // 领取时间 | 51 | /** 领取时间 */ |
50 | @Column(name = "receive_time") | 52 | @Column(name = "receive_time") |
51 | private LocalDateTime receiveTime; | 53 | private Timestamp receiveTime; |
52 | 54 | ||
53 | // 失效时间 | 55 | /** 失效时间 */ |
54 | @Column(name = "expire_time") | 56 | @Column(name = "expire_time") |
55 | private LocalDateTime expireTime; | 57 | private Timestamp expireTime; |
56 | 58 | ||
57 | // 使用状态 0:未使用;1:已使用;-1:已过期 | 59 | /** 使用状态 0:未使用;1:已使用;-1:已过期 */ |
58 | @Column(name = "use_status") | 60 | @Column(name = "use_status") |
59 | private Integer useStatus; | 61 | private Integer useStatus; |
60 | 62 | ||
61 | // 使用时间 | 63 | /** 使用时间 */ |
62 | @Column(name = "use_time") | 64 | @Column(name = "use_time") |
63 | private LocalDateTime useTime; | 65 | private Timestamp useTime; |
64 | 66 | ||
65 | // 订单详情id | 67 | /** 订单详情id */ |
66 | @Column(name = "order_detail_id") | 68 | @Column(name = "order_detail_id") |
67 | private Long orderDetailId; | 69 | private Long orderDetailId; |
68 | 70 | ||
69 | // 创建时间 | 71 | /** 创建时间 */ |
70 | @CreatedDate | 72 | @CreatedDate |
71 | @Column(name = "create_time") | 73 | @Column(name = "create_time") |
72 | private LocalDateTime createTime; | 74 | private Timestamp createTime; |
73 | 75 | ||
74 | // 更新时间 | 76 | /** 更新时间 */ |
75 | @LastModifiedDate | 77 | @LastModifiedDate |
76 | @Column(name = "update_time") | 78 | @Column(name = "update_time") |
77 | private LocalDateTime updateTime; | 79 | private Timestamp updateTime; |
78 | 80 | ||
79 | public void copy(CouponHistory source){ | 81 | public void copy(CouponHistory source){ |
80 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | 82 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ... | ... |
1 | package com.topdraw.business.module.coupon.history.domain; | ||
2 | |||
3 | import com.topdraw.business.module.coupon.domain.Coupon; | ||
4 | import com.topdraw.util.TimestampUtil; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | |||
7 | import java.sql.Timestamp; | ||
8 | import java.util.Objects; | ||
9 | |||
10 | /** | ||
11 | * 优惠券 | ||
12 | */ | ||
13 | public class CouponHistoryBuilder { | ||
14 | |||
15 | public static CouponHistory build(CouponHistory couponHistory){ | ||
16 | return build(couponHistory.getId(), | ||
17 | couponHistory.getCouponId(), | ||
18 | couponHistory.getUserId(), | ||
19 | couponHistory.getCouponCode(), | ||
20 | couponHistory.getUserNickname(), | ||
21 | couponHistory.getReceiveTime(), | ||
22 | couponHistory.getExpireTime(), | ||
23 | couponHistory.getUseStatus(), | ||
24 | couponHistory.getUseTime(), | ||
25 | couponHistory.getOrderDetailId()); | ||
26 | } | ||
27 | |||
28 | public static CouponHistory build(Coupon coupon,Long userId,String userNickname){ | ||
29 | return build(coupon,userId,userNickname,null); | ||
30 | } | ||
31 | |||
32 | public static CouponHistory build(Coupon coupon,Long userId,String userNickname,Long orderDetailId){ | ||
33 | return build(null, | ||
34 | coupon.getId(),userId,coupon.getCode(),userNickname, TimestampUtil.now(), | ||
35 | coupon.getExpireTime(),coupon.getStatus(),null,orderDetailId); | ||
36 | } | ||
37 | |||
38 | public static CouponHistory build(Long id , Long couponId , Long userId, String couponCode, String userNickname, Timestamp receiveTime, | ||
39 | Timestamp expireTime, Integer useStatus, Timestamp useTime, | ||
40 | Long orderDetailId) { | ||
41 | CouponHistory couponHistory = new CouponHistory(); | ||
42 | couponHistory.setId(id); | ||
43 | couponHistory.setCouponId(Objects.isNull(couponId)?null:couponId); | ||
44 | couponHistory.setUserId(Objects.isNull(userId)?null:userId); | ||
45 | couponHistory.setCouponCode(StringUtils.isBlank(couponCode)?null:couponCode); | ||
46 | couponHistory.setUserNickname(StringUtils.isBlank(userNickname)?null:userNickname); | ||
47 | couponHistory.setReceiveTime(Objects.isNull(receiveTime)?null:receiveTime); | ||
48 | couponHistory.setExpireTime(Objects.isNull(expireTime)?null:expireTime); | ||
49 | couponHistory.setUseStatus(Objects.isNull(useStatus)?0:useStatus); | ||
50 | couponHistory.setUseTime(Objects.isNull(useTime)?null:useTime); | ||
51 | couponHistory.setOrderDetailId(Objects.isNull(orderDetailId)?null:orderDetailId); | ||
52 | return couponHistory; | ||
53 | } | ||
54 | |||
55 | } |
1 | package com.topdraw.business.module.coupon.history.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; | ||
5 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; | ||
6 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.data.domain.Pageable; | ||
9 | import org.springframework.validation.annotation.Validated; | ||
10 | import org.springframework.web.bind.annotation.*; | ||
11 | import io.swagger.annotations.*; | ||
12 | |||
13 | /** | ||
14 | * @author XiangHan | ||
15 | * @date 2021-10-23 | ||
16 | */ | ||
17 | @Api(tags = "CouponHistory管理") | ||
18 | @RestController | ||
19 | @RequestMapping("/api/CouponHistory") | ||
20 | public class CouponHistoryController { | ||
21 | |||
22 | @Autowired | ||
23 | private CouponHistoryService CouponHistoryService; | ||
24 | |||
25 | @GetMapping | ||
26 | @ApiOperation("查询CouponHistory") | ||
27 | public ResultInfo getCouponHistorys(CouponHistoryQueryCriteria criteria, Pageable pageable) { | ||
28 | return ResultInfo.successPage(CouponHistoryService.queryAll(criteria,pageable)); | ||
29 | } | ||
30 | |||
31 | @GetMapping(value = "/all") | ||
32 | @ApiOperation("查询所有CouponHistory") | ||
33 | public ResultInfo getCouponHistorys(CouponHistoryQueryCriteria criteria) { | ||
34 | return ResultInfo.success(CouponHistoryService.queryAll(criteria)); | ||
35 | } | ||
36 | |||
37 | @PostMapping(value = "/create") | ||
38 | @ApiOperation("新增CouponHistory") | ||
39 | public ResultInfo create(@Validated @RequestBody CouponHistory resources) { | ||
40 | CouponHistoryService.create(resources); | ||
41 | return ResultInfo.success(); | ||
42 | } | ||
43 | |||
44 | @PutMapping(value = "/update") | ||
45 | @ApiOperation("修改CouponHistory") | ||
46 | public ResultInfo update(@Validated @RequestBody CouponHistory resources) { | ||
47 | CouponHistoryService.update(resources); | ||
48 | return ResultInfo.success(); | ||
49 | } | ||
50 | |||
51 | |||
52 | @DeleteMapping(value = "/delete/{id}") | ||
53 | @ApiOperation("删除CouponHistory") | ||
54 | public ResultInfo delete(@PathVariable Long id) { | ||
55 | CouponHistoryService.delete(id); | ||
56 | return ResultInfo.success(); | ||
57 | } | ||
58 | |||
59 | } |
... | @@ -2,13 +2,8 @@ package com.topdraw.business.module.coupon.history.service; | ... | @@ -2,13 +2,8 @@ package com.topdraw.business.module.coupon.history.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; | 3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
4 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; | 4 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; |
5 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | 5 | ||
8 | import java.sql.Timestamp; | ||
9 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
10 | import java.util.Map; | ||
11 | import java.util.List; | ||
12 | 7 | ||
13 | /** | 8 | /** |
14 | * @author XiangHan | 9 | * @author XiangHan |
... | @@ -16,20 +11,6 @@ import java.util.List; | ... | @@ -16,20 +11,6 @@ import java.util.List; |
16 | */ | 11 | */ |
17 | public interface CouponHistoryService { | 12 | public interface CouponHistoryService { |
18 | 13 | ||
19 | /** | ||
20 | * 查询数据分页 | ||
21 | * @param criteria 条件参数 | ||
22 | * @param pageable 分页参数 | ||
23 | * @return Map<String,Object> | ||
24 | */ | ||
25 | Map<String,Object> queryAll(CouponHistoryQueryCriteria criteria, Pageable pageable); | ||
26 | |||
27 | /** | ||
28 | * 查询所有数据不分页 | ||
29 | * @param criteria 条件参数 | ||
30 | * @return List<CouponHistoryDTO> | ||
31 | */ | ||
32 | List<CouponHistoryDTO> queryAll(CouponHistoryQueryCriteria criteria); | ||
33 | 14 | ||
34 | /** | 15 | /** |
35 | * 根据ID查询 | 16 | * 根据ID查询 |
... | @@ -38,15 +19,33 @@ public interface CouponHistoryService { | ... | @@ -38,15 +19,33 @@ public interface CouponHistoryService { |
38 | */ | 19 | */ |
39 | CouponHistoryDTO findById(Long id); | 20 | CouponHistoryDTO findById(Long id); |
40 | 21 | ||
22 | /** | ||
23 | * | ||
24 | * @param resources | ||
25 | */ | ||
41 | void create(CouponHistory resources); | 26 | void create(CouponHistory resources); |
42 | 27 | ||
43 | void update(CouponHistory resources); | 28 | /** |
44 | 29 | * | |
45 | void delete(Long id); | 30 | * @param userId |
46 | 31 | * @return | |
32 | */ | ||
47 | Long countByUserId(Long userId); | 33 | Long countByUserId(Long userId); |
48 | 34 | ||
35 | /** | ||
36 | * | ||
37 | * @param userId | ||
38 | * @param now | ||
39 | * @return | ||
40 | */ | ||
49 | Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now); | 41 | Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now); |
50 | 42 | ||
43 | /** | ||
44 | * | ||
45 | * @param userId | ||
46 | * @param now | ||
47 | * @param expireTime | ||
48 | * @return | ||
49 | */ | ||
51 | Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime); | 50 | Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime); |
52 | } | 51 | } | ... | ... |
... | @@ -2,7 +2,7 @@ package com.topdraw.business.module.coupon.history.service.dto; | ... | @@ -2,7 +2,7 @@ package com.topdraw.business.module.coupon.history.service.dto; |
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | import java.io.Serializable; | 4 | import java.io.Serializable; |
5 | import java.time.LocalDateTime; | 5 | import java.sql.Timestamp; |
6 | 6 | ||
7 | 7 | ||
8 | /** | 8 | /** |
... | @@ -12,39 +12,39 @@ import java.time.LocalDateTime; | ... | @@ -12,39 +12,39 @@ import java.time.LocalDateTime; |
12 | @Data | 12 | @Data |
13 | public class CouponHistoryDTO implements Serializable { | 13 | public class CouponHistoryDTO implements Serializable { |
14 | 14 | ||
15 | // 主键 | 15 | /** 主键 */ |
16 | private Long id; | 16 | private Long id; |
17 | 17 | ||
18 | // 优惠券id | 18 | /** 优惠券id */ |
19 | private Long couponId; | 19 | private Long couponId; |
20 | 20 | ||
21 | // 领券用户id(对应账号) | 21 | /** 领券用户id(对应账号) */ |
22 | private Long userId; | 22 | private Long userId; |
23 | 23 | ||
24 | // 优惠券code | 24 | /** 优惠券code */ |
25 | private String couponCode; | 25 | private String couponCode; |
26 | 26 | ||
27 | // 领取人昵称 | 27 | /** 领取人昵称 */ |
28 | private String userNickname; | 28 | private String userNickname; |
29 | 29 | ||
30 | // 领取时间 | 30 | /** 领取时间 */ |
31 | private LocalDateTime receiveTime; | 31 | private Timestamp receiveTime; |
32 | 32 | ||
33 | // 失效时间 | 33 | /** 失效时间 */ |
34 | private LocalDateTime expireTime; | 34 | private Timestamp expireTime; |
35 | 35 | ||
36 | // 使用状态 0:未使用;1:已使用;-1:已过期 | 36 | /** 使用状态 0:未使用;1:已使用;-1:已过期 */ |
37 | private Integer useStatus; | 37 | private Integer useStatus; |
38 | 38 | ||
39 | // 使用时间 | 39 | /** 使用时间 */ |
40 | private LocalDateTime useTime; | 40 | private Timestamp useTime; |
41 | 41 | ||
42 | // 订单详情id | 42 | /** 订单详情id */ |
43 | private Long orderDetailId; | 43 | private Long orderDetailId; |
44 | 44 | ||
45 | // 创建时间 | 45 | /** 创建时间 */ |
46 | private LocalDateTime createTime; | 46 | private Timestamp createTime; |
47 | 47 | ||
48 | // 更新时间 | 48 | /** 更新时间 */ |
49 | private LocalDateTime updateTime; | 49 | private Timestamp updateTime; |
50 | } | 50 | } | ... | ... |
1 | package com.topdraw.business.module.coupon.history.service.impl; | 1 | package com.topdraw.business.module.coupon.history.service.impl; |
2 | 2 | ||
3 | import com.topdraw.aspect.AsyncMqSend; | ||
4 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; | 3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
4 | import com.topdraw.business.module.coupon.history.domain.CouponHistoryBuilder; | ||
5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
6 | import com.topdraw.business.module.coupon.history.repository.CouponHistoryRepository; | 6 | import com.topdraw.business.module.coupon.history.repository.CouponHistoryRepository; |
7 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; | 7 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; |
8 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; | 8 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; |
9 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; | ||
10 | import com.topdraw.business.module.coupon.history.service.mapper.CouponHistoryMapper; | 9 | import com.topdraw.business.module.coupon.history.service.mapper.CouponHistoryMapper; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
13 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
14 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; |
15 | import org.springframework.dao.EmptyResultDataAccessException; | ||
16 | import org.springframework.data.domain.Page; | ||
17 | import org.springframework.data.domain.Pageable; | ||
18 | import org.springframework.util.Assert; | ||
19 | import com.topdraw.utils.PageUtil; | ||
20 | import com.topdraw.utils.QueryHelp; | ||
21 | 14 | ||
22 | import java.sql.Timestamp; | ||
23 | import java.time.LocalDateTime; | 15 | import java.time.LocalDateTime; |
24 | import java.util.List; | ||
25 | import java.util.Map; | ||
26 | 16 | ||
27 | /** | 17 | /** |
28 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -33,69 +23,38 @@ import java.util.Map; | ... | @@ -33,69 +23,38 @@ import java.util.Map; |
33 | public class CouponHistoryServiceImpl implements CouponHistoryService { | 23 | public class CouponHistoryServiceImpl implements CouponHistoryService { |
34 | 24 | ||
35 | @Autowired | 25 | @Autowired |
36 | private CouponHistoryRepository CouponHistoryRepository; | 26 | private CouponHistoryMapper couponHistoryMapper; |
37 | |||
38 | @Autowired | 27 | @Autowired |
39 | private CouponHistoryMapper CouponHistoryMapper; | 28 | private CouponHistoryRepository couponHistoryRepository; |
40 | |||
41 | @Override | ||
42 | public Map<String, Object> queryAll(CouponHistoryQueryCriteria criteria, Pageable pageable) { | ||
43 | Page<CouponHistory> page = CouponHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
44 | return PageUtil.toPage(page.map(CouponHistoryMapper::toDto)); | ||
45 | } | ||
46 | 29 | ||
47 | @Override | ||
48 | public List<CouponHistoryDTO> queryAll(CouponHistoryQueryCriteria criteria) { | ||
49 | return CouponHistoryMapper.toDto(CouponHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
50 | } | ||
51 | 30 | ||
52 | @Override | 31 | @Override |
53 | public CouponHistoryDTO findById(Long id) { | 32 | public CouponHistoryDTO findById(Long id) { |
54 | CouponHistory CouponHistory = CouponHistoryRepository.findById(id).orElseGet(CouponHistory::new); | 33 | CouponHistory couponHistory = this.couponHistoryRepository.findById(id).orElseGet(CouponHistory::new); |
55 | ValidationUtil.isNull(CouponHistory.getId(),"CouponHistory","id",id); | 34 | ValidationUtil.isNull(couponHistory.getId(),"CouponHistory","id",id); |
56 | return CouponHistoryMapper.toDto(CouponHistory); | 35 | return this.couponHistoryMapper.toDto(couponHistory); |
57 | } | 36 | } |
58 | 37 | ||
59 | @Override | 38 | @Override |
60 | @Transactional(rollbackFor = Exception.class) | 39 | @Transactional(rollbackFor = Exception.class) |
61 | @AsyncMqSend() | ||
62 | public void create(CouponHistory resources) { | 40 | public void create(CouponHistory resources) { |
63 | CouponHistoryRepository.save(resources); | 41 | CouponHistory couponHistory = CouponHistoryBuilder.build(resources); |
64 | } | 42 | this.couponHistoryRepository.save(couponHistory); |
65 | |||
66 | @Override | ||
67 | @Transactional(rollbackFor = Exception.class) | ||
68 | @AsyncMqSend() | ||
69 | public void update(CouponHistory resources) { | ||
70 | CouponHistory CouponHistory = CouponHistoryRepository.findById(resources.getId()).orElseGet(CouponHistory::new); | ||
71 | ValidationUtil.isNull( CouponHistory.getId(),"CouponHistory","id",resources.getId()); | ||
72 | CouponHistory.copy(resources); | ||
73 | CouponHistoryRepository.save(CouponHistory); | ||
74 | } | ||
75 | |||
76 | @Override | ||
77 | @Transactional(rollbackFor = Exception.class) | ||
78 | public void delete(Long id) { | ||
79 | Assert.notNull(id, "The given id must not be null!"); | ||
80 | CouponHistory CouponHistory = CouponHistoryRepository.findById(id).orElseThrow( | ||
81 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", CouponHistory.class, id), 1)); | ||
82 | CouponHistoryRepository.delete(CouponHistory); | ||
83 | } | 43 | } |
84 | 44 | ||
85 | @Override | 45 | @Override |
86 | public Long countByUserId(Long userId) { | 46 | public Long countByUserId(Long userId) { |
87 | return this.CouponHistoryRepository.countByUserId(userId); | 47 | return this.couponHistoryRepository.countByUserId(userId); |
88 | } | 48 | } |
89 | 49 | ||
90 | @Override | 50 | @Override |
91 | public Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now) { | 51 | public Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now) { |
92 | return this.CouponHistoryRepository.countByUserIdAndExpireTimeBefore(userId,now); | 52 | return this.couponHistoryRepository.countByUserIdAndExpireTimeBefore(userId,now); |
93 | } | 53 | } |
94 | 54 | ||
95 | @Override | 55 | @Override |
96 | public Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime) { | 56 | public Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime) { |
97 | return this.CouponHistoryRepository.countByUserIdAndExpireTimeBetween(userId,now,expireTime); | 57 | return this.couponHistoryRepository.countByUserIdAndExpireTimeBetween(userId,now,expireTime); |
98 | } | 58 | } |
99 | 59 | ||
100 | |||
101 | } | 60 | } | ... | ... |
1 | package com.topdraw.business.module.coupon.repository; | 1 | package com.topdraw.business.module.coupon.repository; |
2 | 2 | ||
3 | import com.topdraw.business.module.coupon.domain.Coupon; | 3 | import com.topdraw.business.module.coupon.domain.Coupon; |
4 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
6 | 7 | ||
8 | import java.util.List; | ||
7 | import java.util.Optional; | 9 | import java.util.Optional; |
8 | 10 | ||
9 | /** | 11 | /** |
... | @@ -13,4 +15,5 @@ import java.util.Optional; | ... | @@ -13,4 +15,5 @@ import java.util.Optional; |
13 | public interface CouponRepository extends JpaRepository<Coupon, Long>, JpaSpecificationExecutor<Coupon> { | 15 | public interface CouponRepository extends JpaRepository<Coupon, Long>, JpaSpecificationExecutor<Coupon> { |
14 | 16 | ||
15 | Optional<Coupon> findFirstByCode(String code); | 17 | Optional<Coupon> findFirstByCode(String code); |
18 | |||
16 | } | 19 | } | ... | ... |
1 | package com.topdraw.business.module.coupon.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.coupon.domain.Coupon; | ||
5 | import com.topdraw.business.module.coupon.service.CouponService; | ||
6 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.data.domain.Pageable; | ||
9 | import org.springframework.validation.annotation.Validated; | ||
10 | import org.springframework.web.bind.annotation.*; | ||
11 | import io.swagger.annotations.*; | ||
12 | |||
13 | /** | ||
14 | * @author XiangHan | ||
15 | * @date 2021-10-22 | ||
16 | */ | ||
17 | @Api(tags = "Coupon管理") | ||
18 | @RestController | ||
19 | @RequestMapping("/api/Coupon") | ||
20 | public class CouponController { | ||
21 | |||
22 | @Autowired | ||
23 | private CouponService CouponService; | ||
24 | |||
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") | ||
38 | @ApiOperation("新增Coupon") | ||
39 | public ResultInfo create(@Validated @RequestBody Coupon resources) { | ||
40 | CouponService.create(resources); | ||
41 | return ResultInfo.success(); | ||
42 | } | ||
43 | |||
44 | @PutMapping(value = "/update") | ||
45 | @ApiOperation("修改Coupon") | ||
46 | public ResultInfo update(@Validated @RequestBody Coupon resources) { | ||
47 | CouponService.update(resources); | ||
48 | return ResultInfo.success(); | ||
49 | } | ||
50 | |||
51 | @DeleteMapping(value = "/delete/{id}") | ||
52 | @ApiOperation("删除Coupon") | ||
53 | public ResultInfo delete(@PathVariable Long id) { | ||
54 | CouponService.delete(id); | ||
55 | return ResultInfo.success(); | ||
56 | } | ||
57 | |||
58 | @GetMapping(value = "/getByCode/{code}") | ||
59 | @ApiOperation(value = "根据标识查询") | ||
60 | public ResultInfo getByCode(@PathVariable String code) { | ||
61 | return ResultInfo.success(CouponService.getByCode(code)); | ||
62 | } | ||
63 | } |
1 | package com.topdraw.business.module.coupon.service; | 1 | package com.topdraw.business.module.coupon.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.coupon.domain.Coupon; | ||
4 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; | 3 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
5 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | ||
9 | 4 | ||
10 | /** | 5 | /** |
11 | * @author XiangHan | 6 | * @author XiangHan |
... | @@ -14,37 +9,18 @@ import java.util.List; | ... | @@ -14,37 +9,18 @@ import java.util.List; |
14 | public interface CouponService { | 9 | public interface CouponService { |
15 | 10 | ||
16 | /** | 11 | /** |
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 | /** | ||
32 | * 根据ID查询 | 12 | * 根据ID查询 |
33 | * @param id ID | 13 | * @param id ID |
34 | * @return CouponDTO | 14 | * @return CouponDTO |
35 | */ | 15 | */ |
36 | CouponDTO findById(Long id); | 16 | CouponDTO findById(Long id); |
37 | 17 | ||
38 | void create(Coupon resources); | ||
39 | |||
40 | void update(Coupon resources); | ||
41 | |||
42 | void delete(Long id); | ||
43 | |||
44 | /** | 18 | /** |
45 | * Code校验 | 19 | * Code校验 |
46 | * @param code | 20 | * @param code |
47 | * @return CouponDTO | 21 | * @return CouponDTO |
48 | */ | 22 | */ |
49 | CouponDTO getByCode(String code); | 23 | CouponDTO getByCode(String code); |
24 | |||
25 | |||
50 | } | 26 | } | ... | ... |
... | @@ -4,7 +4,6 @@ import lombok.Data; | ... | @@ -4,7 +4,6 @@ import lombok.Data; |
4 | import java.sql.Timestamp; | 4 | import java.sql.Timestamp; |
5 | import java.math.BigDecimal; | 5 | import java.math.BigDecimal; |
6 | import java.io.Serializable; | 6 | import java.io.Serializable; |
7 | import java.time.LocalDateTime; | ||
8 | 7 | ||
9 | 8 | ||
10 | /** | 9 | /** |
... | @@ -14,69 +13,69 @@ import java.time.LocalDateTime; | ... | @@ -14,69 +13,69 @@ import java.time.LocalDateTime; |
14 | @Data | 13 | @Data |
15 | public class CouponDTO implements Serializable { | 14 | public class CouponDTO implements Serializable { |
16 | 15 | ||
17 | // id | 16 | /** id */ |
18 | private Long id; | 17 | private Long id; |
19 | 18 | ||
20 | // 标识 | 19 | /** 标识 */ |
21 | private String code; | 20 | private String code; |
22 | 21 | ||
23 | // 名称 | 22 | /** 名称 */ |
24 | private String title; | 23 | private String title; |
25 | 24 | ||
26 | // 图片 | 25 | /** 图片 */ |
27 | private String images; | 26 | private String images; |
28 | 27 | ||
29 | // 发行量,-1代表不限量 | 28 | /** 发行量,-1代表不限量 */ |
30 | private Integer stock; | 29 | private Integer stock; |
31 | 30 | ||
32 | // 剩余量,-1代表不限量 | 31 | /** 剩余量,-1代表不限量 */ |
33 | private Integer remainStock; | 32 | private Integer remainStock; |
34 | 33 | ||
35 | // 优惠形式:1:现金;2:折扣 | 34 | /** 优惠形式:1:现金;2:折扣 */ |
36 | private Integer useType; | 35 | private Integer useType; |
37 | 36 | ||
38 | // 面额 | 37 | /** 面额 */ |
39 | private BigDecimal denomination; | 38 | private BigDecimal denomination; |
40 | 39 | ||
41 | // 折扣 | 40 | /** 折扣 */ |
42 | private BigDecimal discount; | 41 | private BigDecimal discount; |
43 | 42 | ||
44 | // 适用用户范围:1:新用户;2:全体用户 | 43 | /** 适用用户范围:1:新用户;2:全体用户 */ |
45 | private Integer userRange; | 44 | private Integer userRange; |
46 | 45 | ||
47 | // 限领次数 -1:无限次; >0:具体次数 | 46 | /** 限领次数 -1:无限次; >0:具体次数 */ |
48 | private Integer collectLimit; | 47 | private Integer collectLimit; |
49 | 48 | ||
50 | // 适用门槛:1:无门槛;2:满减形式 | 49 | /** 适用门槛:1:无门槛;2:满减形式 */ |
51 | private Integer thresholdType; | 50 | private Integer thresholdType; |
52 | 51 | ||
53 | // 满减门槛 | 52 | /** 满减门槛 */ |
54 | private BigDecimal amountThreshold; | 53 | private BigDecimal amountThreshold; |
55 | 54 | ||
56 | // 产品范围:1:全部商品;2:指定商品 | 55 | /** 产品范围:1:全部商品;2:指定商品 */ |
57 | private Integer itemRange; | 56 | private Integer itemRange; |
58 | 57 | ||
59 | // 生效形式:1:固定日期;2:相对日期 | 58 | /** 生效形式:1:固定日期;2:相对日期 */ |
60 | private Integer effectType; | 59 | private Integer effectType; |
61 | 60 | ||
62 | // 生效时间 | 61 | /** 生效时间 */ |
63 | private Timestamp startTime; | 62 | private Timestamp startTime; |
64 | 63 | ||
65 | // 过期时间 | 64 | /** 过期时间 */ |
66 | private LocalDateTime expireTime; | 65 | private Timestamp expireTime; |
67 | 66 | ||
68 | // 自领取当日,几天内有效 | 67 | /** 自领取当日,几天内有效 */ |
69 | private Integer validDays; | 68 | private Integer validDays; |
70 | 69 | ||
71 | // 使用说明 | 70 | /** 使用说明 */ |
72 | private String description; | 71 | private String description; |
73 | 72 | ||
74 | // 状态0:未开始,1:启用;2:停用 | 73 | /** 状态0:未开始,1:启用;2:停用 */ |
75 | private Integer status; | 74 | private Integer status; |
76 | 75 | ||
77 | // 创建时间 | 76 | /** 创建时间 */ |
78 | private Timestamp createTime; | 77 | private Timestamp createTime; |
79 | 78 | ||
80 | // 更新时间 | 79 | /** 更新时间 */ |
81 | private Timestamp updateTime; | 80 | private Timestamp updateTime; |
82 | } | 81 | } | ... | ... |
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.exception.GlobeExceptionMsg; |
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; | ||
13 | import org.redisson.api.RedissonClient; | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
15 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
16 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
17 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; |
18 | 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; | 14 | import org.springframework.util.Assert; |
22 | import com.topdraw.utils.PageUtil; | ||
23 | import com.topdraw.utils.QueryHelp; | ||
24 | import com.topdraw.utils.StringUtils; | 15 | import com.topdraw.utils.StringUtils; |
25 | 16 | ||
26 | import java.util.List; | ||
27 | import java.util.Map; | ||
28 | 17 | ||
29 | /** | 18 | /** |
30 | * @author XiangHan | 19 | * @author XiangHan |
... | @@ -34,73 +23,24 @@ import java.util.Map; | ... | @@ -34,73 +23,24 @@ import java.util.Map; |
34 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
35 | public class CouponServiceImpl implements CouponService { | 24 | public class CouponServiceImpl implements CouponService { |
36 | 25 | ||
37 | @Autowired | ||
38 | private CouponRepository CouponRepository; | ||
39 | 26 | ||
40 | @Autowired | 27 | @Autowired |
41 | private CouponMapper CouponMapper; | 28 | private CouponMapper couponMapper; |
42 | |||
43 | @Autowired | 29 | @Autowired |
44 | private RedissonClient redissonClient; | 30 | private CouponRepository couponRepository; |
45 | |||
46 | @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 | 31 | ||
57 | @Override | 32 | @Override |
58 | public CouponDTO findById(Long id) { | 33 | public CouponDTO findById(Long id) { |
59 | Coupon Coupon = CouponRepository.findById(id).orElseGet(Coupon::new); | 34 | Assert.notNull(id, GlobeExceptionMsg.COUPON_ID_IS_NULL); |
60 | ValidationUtil.isNull(Coupon.getId(),"Coupon","id",id); | ||
61 | return CouponMapper.toDto(Coupon); | ||
62 | } | ||
63 | 35 | ||
64 | @Override | 36 | Coupon coupon = this.couponRepository.findById(id).orElseGet(Coupon::new); |
65 | @Transactional(rollbackFor = Exception.class) | 37 | ValidationUtil.isNull(coupon.getId(),"Coupon","id",id); |
66 | @AsyncMqSend() | 38 | return this.couponMapper.toDto(coupon); |
67 | public void create(Coupon resources) { | ||
68 | CouponRepository.save(resources); | ||
69 | } | ||
70 | |||
71 | @Override | ||
72 | @Transactional(rollbackFor = Exception.class) | ||
73 | @AsyncMqSend() | ||
74 | public void update(Coupon resources) { | ||
75 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); | ||
76 | try { | ||
77 | RedissonUtil.lock(rLock); | ||
78 | Coupon Coupon = CouponRepository.findById(resources.getId()).orElseGet(Coupon::new); | ||
79 | ValidationUtil.isNull( Coupon.getId(),"Coupon","id",resources.getId()); | ||
80 | Coupon.copy(resources); | ||
81 | CouponRepository.save(Coupon); | ||
82 | } catch (Exception e) { | ||
83 | e.printStackTrace(); | ||
84 | throw e; | ||
85 | } finally { | ||
86 | RedissonUtil.unlock(rLock); | ||
87 | } | ||
88 | } | 39 | } |
89 | 40 | ||
90 | @Override | 41 | @Override |
91 | @Transactional(rollbackFor = Exception.class) | ||
92 | @AsyncMqSend() | ||
93 | public void delete(Long id) { | ||
94 | Assert.notNull(id, "The given id must not be null!"); | ||
95 | Coupon Coupon = CouponRepository.findById(id).orElseThrow( | ||
96 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", Coupon.class, id), 1)); | ||
97 | CouponRepository.delete(Coupon); | ||
98 | } | ||
99 | |||
100 | |||
101 | @Override | ||
102 | public CouponDTO getByCode(String code) { | 42 | public CouponDTO getByCode(String code) { |
103 | return StringUtils.isNotEmpty(code) ? CouponMapper.toDto(CouponRepository.findFirstByCode(code).orElseGet(Coupon::new)) | 43 | return StringUtils.isNotEmpty(code) ? this.couponMapper.toDto(this.couponRepository.findFirstByCode(code).orElseGet(Coupon::new)) |
104 | : new CouponDTO(); | 44 | : new CouponDTO(); |
105 | } | 45 | } |
106 | } | 46 | } | ... | ... |
... | @@ -23,70 +23,73 @@ import java.io.Serializable; | ... | @@ -23,70 +23,73 @@ import java.io.Serializable; |
23 | @Table(name="uc_exp_detail") | 23 | @Table(name="uc_exp_detail") |
24 | public class ExpDetail implements Serializable { | 24 | public class ExpDetail implements Serializable { |
25 | 25 | ||
26 | // 主键 | 26 | @Transient |
27 | private String memberCode; | ||
28 | |||
29 | /** 主键 */ | ||
27 | @Id | 30 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 31 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 32 | @Column(name = "id") |
30 | private Long id; | 33 | private Long id; |
31 | 34 | ||
32 | // 标识 | 35 | /** 标识 */ |
33 | @Column(name = "code", nullable = false) | 36 | @Column(name = "code", nullable = false) |
34 | private String code; | 37 | private String code; |
35 | 38 | ||
36 | // 应用code | 39 | /** 应用code */ |
37 | @Column(name = "app_code") | 40 | @Column(name = "app_code") |
38 | private String appCode; | 41 | private String appCode; |
39 | 42 | ||
40 | // 会员id | 43 | /** 会员id */ |
41 | @Column(name = "member_id", nullable = false) | 44 | @Column(name = "member_id", nullable = false) |
42 | private Long memberId; | 45 | private Long memberId; |
43 | 46 | ||
44 | // 账号id | 47 | /** 账号id */ |
45 | @Column(name = "account_id") | 48 | @Column(name = "account_id") |
46 | private Long accountId; | 49 | private Long accountId; |
47 | 50 | ||
48 | // 原始成长值 | 51 | /** 原始成长值 */ |
49 | @Column(name = "original_exp", nullable = false) | 52 | @Column(name = "original_exp", nullable = false) |
50 | private Long originalExp; | 53 | private Long originalExp; |
51 | 54 | ||
52 | // 结果成长值 | 55 | /** 结果成长值 */ |
53 | @Column(name = "result_exp", nullable = false) | 56 | @Column(name = "result_exp", nullable = false) |
54 | private Long resultExp; | 57 | private Long resultExp; |
55 | 58 | ||
56 | // 成长值变化,一般为正数 | 59 | /** 成长值变化,一般为正数 */ |
57 | @Column(name = "exp", nullable = false) | 60 | @Column(name = "exp", nullable = false) |
58 | private Long exp; | 61 | private Long exp; |
59 | 62 | ||
60 | // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 63 | /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */ |
61 | @Column(name = "device_type", nullable = false) | 64 | @Column(name = "device_type", nullable = false) |
62 | private Integer deviceType; | 65 | private Integer deviceType; |
63 | 66 | ||
64 | // 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 | 67 | /** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 */ |
65 | @Column(name = "evt_type", nullable = false) | 68 | @Column(name = "evt_type", nullable = false) |
66 | private Integer evtType; | 69 | private Integer evtType; |
67 | 70 | ||
68 | // 订单id(针对订购操作) | 71 | /** 订单id(针对订购操作) */ |
69 | @Column(name = "order_id") | 72 | @Column(name = "order_id") |
70 | private Long orderId; | 73 | private Long orderId; |
71 | 74 | ||
72 | // 节目id(针对观影操作) | 75 | /** 节目id(针对观影操作) */ |
73 | @Column(name = "media_id") | 76 | @Column(name = "media_id") |
74 | private Long mediaId; | 77 | private Long mediaId; |
75 | 78 | ||
76 | // 活动id(针对参与活动) | 79 | /** 活动id(针对参与活动) */ |
77 | @Column(name = "activity_id") | 80 | @Column(name = "activity_id") |
78 | private Long activityId; | 81 | private Long activityId; |
79 | 82 | ||
80 | // 成长值变化描述,用于管理侧显示 | 83 | /** 成长值变化描述,用于管理侧显示 */ |
81 | @Column(name = "description", nullable = false) | 84 | @Column(name = "description", nullable = false) |
82 | private String description; | 85 | private String description; |
83 | 86 | ||
84 | // 创建时间 | 87 | /** 创建时间 */ |
85 | @CreatedDate | 88 | @CreatedDate |
86 | @Column(name = "create_time") | 89 | @Column(name = "create_time") |
87 | private Timestamp createTime; | 90 | private Timestamp createTime; |
88 | 91 | ||
89 | // 更新时间 | 92 | /** 更新时间 */ |
90 | @LastModifiedDate | 93 | @LastModifiedDate |
91 | @Column(name = "update_time") | 94 | @Column(name = "update_time") |
92 | private Timestamp updateTime; | 95 | private Timestamp updateTime; | ... | ... |
1 | package com.topdraw.business.module.exp.detail.domain; | ||
2 | |||
3 | import com.topdraw.exception.GlobeExceptionMsg; | ||
4 | import org.apache.commons.lang3.StringUtils; | ||
5 | import org.springframework.util.Assert; | ||
6 | |||
7 | import java.util.Objects; | ||
8 | |||
9 | public class ExpDetailBuilder { | ||
10 | |||
11 | public static ExpDetail build(Long memberId, Long originalExp, Long resultExp, | ||
12 | Integer deviceType, Integer evtType){ | ||
13 | ExpDetail expDetail = new ExpDetail(); | ||
14 | expDetail.setMemberId(memberId); | ||
15 | expDetail.setOriginalExp(originalExp); | ||
16 | expDetail.setResultExp(resultExp); | ||
17 | expDetail.setDeviceType(deviceType); | ||
18 | expDetail.setEvtType(evtType); | ||
19 | return build(expDetail); | ||
20 | } | ||
21 | |||
22 | public static ExpDetail build(ExpDetail expDetail){ | ||
23 | return build(expDetail.getId(), | ||
24 | expDetail.getCode(), | ||
25 | expDetail.getAppCode(), | ||
26 | expDetail.getMemberId(), | ||
27 | expDetail.getAccountId(), | ||
28 | expDetail.getOriginalExp(),expDetail.getResultExp(), | ||
29 | expDetail.getExp(),expDetail.getDeviceType(), | ||
30 | expDetail.getEvtType(), expDetail.getOrderId(), expDetail.getMediaId(), | ||
31 | expDetail.getActivityId(),expDetail.getDescription()); | ||
32 | } | ||
33 | |||
34 | public static ExpDetail build(Long id, String code, | ||
35 | String appCode, Long memberId, Long accountId, | ||
36 | Long originalExp, Long resultExp, Long exp, | ||
37 | Integer deviceType, Integer evtType, Long orderId, | ||
38 | Long mediaId, Long activityId, String description){ | ||
39 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
40 | |||
41 | ExpDetail expDetail = new ExpDetail(); | ||
42 | expDetail.setId(Objects.isNull(id)?null:id); | ||
43 | expDetail.setCode(StringUtils.isBlank(code)?null:code); | ||
44 | expDetail.setAppCode(StringUtils.isBlank(appCode)?null:appCode); | ||
45 | expDetail.setMemberId(Objects.isNull(memberId)?null:memberId); | ||
46 | expDetail.setAccountId(Objects.isNull(accountId)?null:accountId); | ||
47 | expDetail.setOriginalExp(Objects.isNull(originalExp)?0:originalExp); | ||
48 | expDetail.setResultExp(Objects.isNull(resultExp)?0:resultExp); | ||
49 | expDetail.setExp(Objects.isNull(exp)?0:exp); | ||
50 | expDetail.setDeviceType(Objects.isNull(deviceType)?null:deviceType); | ||
51 | expDetail.setEvtType(Objects.isNull(evtType)?null:evtType); | ||
52 | expDetail.setOrderId(Objects.isNull(orderId)?null:orderId); | ||
53 | expDetail.setMediaId(Objects.isNull(mediaId)?null:mediaId); | ||
54 | expDetail.setActivityId(Objects.isNull(activityId)?null:activityId); | ||
55 | expDetail.setDescription(StringUtils.isBlank(description)?null:description); | ||
56 | return expDetail; | ||
57 | } | ||
58 | |||
59 | } |
1 | package com.topdraw.business.module.exp.detail.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; | ||
5 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; | ||
6 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.data.domain.Pageable; | ||
9 | import org.springframework.validation.annotation.Validated; | ||
10 | import org.springframework.web.bind.annotation.*; | ||
11 | import io.swagger.annotations.*; | ||
12 | |||
13 | /** | ||
14 | * @author XiangHan | ||
15 | * @date 2021-10-22 | ||
16 | */ | ||
17 | @Api(tags = "ExpDetail管理") | ||
18 | @RestController | ||
19 | @RequestMapping("/api/ExpDetail") | ||
20 | public class ExpDetailController { | ||
21 | |||
22 | @Autowired | ||
23 | private ExpDetailService ExpDetailService; | ||
24 | |||
25 | @GetMapping | ||
26 | @ApiOperation("查询ExpDetail") | ||
27 | public ResultInfo getExpDetails(ExpDetailQueryCriteria criteria, Pageable pageable) { | ||
28 | return ResultInfo.successPage(ExpDetailService.queryAll(criteria,pageable)); | ||
29 | } | ||
30 | |||
31 | @GetMapping(value = "/all") | ||
32 | @ApiOperation("查询所有ExpDetail") | ||
33 | public ResultInfo getExpDetails(ExpDetailQueryCriteria criteria) { | ||
34 | return ResultInfo.success(ExpDetailService.queryAll(criteria)); | ||
35 | } | ||
36 | |||
37 | @PostMapping(value = "/create") | ||
38 | @ApiOperation("新增ExpDetail") | ||
39 | public ResultInfo create(@Validated @RequestBody ExpDetail resources) { | ||
40 | ExpDetailService.create(resources); | ||
41 | return ResultInfo.success(); | ||
42 | } | ||
43 | |||
44 | @PutMapping(value = "/update") | ||
45 | @ApiOperation("修改ExpDetail") | ||
46 | public ResultInfo update(@Validated @RequestBody ExpDetail resources) { | ||
47 | ExpDetailService.update(resources); | ||
48 | return ResultInfo.success(); | ||
49 | } | ||
50 | |||
51 | @DeleteMapping(value = "/delete/{id}") | ||
52 | @ApiOperation("删除ExpDetail") | ||
53 | public ResultInfo delete(@PathVariable Long id) { | ||
54 | ExpDetailService.delete(id); | ||
55 | return ResultInfo.success(); | ||
56 | } | ||
57 | |||
58 | @GetMapping(value = "/getByCode/{code}") | ||
59 | @ApiOperation(value = "根据标识查询") | ||
60 | public ResultInfo getByCode(@PathVariable String code) { | ||
61 | return ResultInfo.success(ExpDetailService.getByCode(code)); | ||
62 | } | ||
63 | } |
... | @@ -2,10 +2,6 @@ package com.topdraw.business.module.exp.detail.service; | ... | @@ -2,10 +2,6 @@ package com.topdraw.business.module.exp.detail.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; | 3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
4 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; | 4 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; |
5 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | ||
9 | 5 | ||
10 | /** | 6 | /** |
11 | * @author XiangHan | 7 | * @author XiangHan |
... | @@ -14,31 +10,28 @@ import java.util.List; | ... | @@ -14,31 +10,28 @@ import java.util.List; |
14 | public interface ExpDetailService { | 10 | public interface ExpDetailService { |
15 | 11 | ||
16 | /** | 12 | /** |
17 | * 查询数据分页 | ||
18 | * @param criteria 条件参数 | ||
19 | * @param pageable 分页参数 | ||
20 | * @return Map<String,Object> | ||
21 | */ | ||
22 | Map<String,Object> queryAll(ExpDetailQueryCriteria criteria, Pageable pageable); | ||
23 | |||
24 | /** | ||
25 | * 查询所有数据不分页 | ||
26 | * @param criteria 条件参数 | ||
27 | * @return List<ExpDetailDTO> | ||
28 | */ | ||
29 | List<ExpDetailDTO> queryAll(ExpDetailQueryCriteria criteria); | ||
30 | |||
31 | /** | ||
32 | * 根据ID查询 | 13 | * 根据ID查询 |
33 | * @param id ID | 14 | * @param id ID |
34 | * @return ExpDetailDTO | 15 | * @return ExpDetailDTO |
35 | */ | 16 | */ |
36 | ExpDetailDTO findById(Long id); | 17 | ExpDetailDTO findById(Long id); |
37 | 18 | ||
19 | /** | ||
20 | * | ||
21 | * @param resources | ||
22 | */ | ||
38 | void create(ExpDetail resources); | 23 | void create(ExpDetail resources); |
39 | 24 | ||
25 | /** | ||
26 | * | ||
27 | * @param resources | ||
28 | */ | ||
40 | void update(ExpDetail resources); | 29 | void update(ExpDetail resources); |
41 | 30 | ||
31 | /** | ||
32 | * | ||
33 | * @param id | ||
34 | */ | ||
42 | void delete(Long id); | 35 | void delete(Long id); |
43 | 36 | ||
44 | /** | 37 | /** | ... | ... |
... | @@ -12,51 +12,51 @@ import java.io.Serializable; | ... | @@ -12,51 +12,51 @@ import java.io.Serializable; |
12 | @Data | 12 | @Data |
13 | public class ExpDetailDTO implements Serializable { | 13 | public class ExpDetailDTO implements Serializable { |
14 | 14 | ||
15 | // 主键 | 15 | /** 主键 */ |
16 | private Long id; | 16 | private Long id; |
17 | 17 | ||
18 | // 标识 | 18 | /** 标识 */ |
19 | private String code; | 19 | private String code; |
20 | 20 | ||
21 | // 应用code | 21 | /** 应用code */ |
22 | private String appCode; | 22 | private String appCode; |
23 | 23 | ||
24 | // 会员id | 24 | /** 会员id */ |
25 | private Long memberId; | 25 | private Long memberId; |
26 | 26 | ||
27 | // 账号id | 27 | /** 账号id */ |
28 | private Long accountId; | 28 | private Long accountId; |
29 | 29 | ||
30 | // 原始成长值 | 30 | /** 原始成长值 */ |
31 | private Long originalExp; | 31 | private Long originalExp; |
32 | 32 | ||
33 | // 结果成长值 | 33 | /** 结果成长值 */ |
34 | private Long resultExp; | 34 | private Long resultExp; |
35 | 35 | ||
36 | // 成长值变化,一般为正数 | 36 | /** 成长值变化,一般为正数 */ |
37 | private Long exp; | 37 | private Long exp; |
38 | 38 | ||
39 | // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 39 | /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */ |
40 | private Integer deviceType; | 40 | private Integer deviceType; |
41 | 41 | ||
42 | // 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 | 42 | /** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 */ |
43 | private Integer evtType; | 43 | private Integer evtType; |
44 | 44 | ||
45 | // 订单id(针对订购操作) | 45 | /** 订单id(针对订购操作) */ |
46 | private Long orderId; | 46 | private Long orderId; |
47 | 47 | ||
48 | // 节目id(针对观影操作) | 48 | /** 节目id(针对观影操作) */ |
49 | private Long mediaId; | 49 | private Long mediaId; |
50 | 50 | ||
51 | // 活动id(针对参与活动) | 51 | /** 活动id(针对参与活动) */ |
52 | private Long activityId; | 52 | private Long activityId; |
53 | 53 | ||
54 | // 成长值变化描述,用于管理侧显示 | 54 | /** 成长值变化描述,用于管理侧显示 */ |
55 | private String description; | 55 | private String description; |
56 | 56 | ||
57 | // 创建时间 | 57 | /** 创建时间 */ |
58 | private Timestamp createTime; | 58 | private Timestamp createTime; |
59 | 59 | ||
60 | // 更新时间 | 60 | /** 更新时间 */ |
61 | private Timestamp updateTime; | 61 | private Timestamp updateTime; |
62 | } | 62 | } | ... | ... |
1 | package com.topdraw.business.module.exp.detail.service.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; |
4 | import com.topdraw.business.module.exp.detail.domain.ExpDetailBuilder; | ||
5 | import com.topdraw.utils.RedisUtils; | ||
5 | import com.topdraw.utils.ValidationUtil; | 6 | import com.topdraw.utils.ValidationUtil; |
6 | import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository; | 7 | import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository; |
7 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; | 8 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; |
8 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; | 9 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; |
9 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; | ||
10 | import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper; | 10 | import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper; |
11 | import org.redisson.api.RLock; | ||
12 | import org.redisson.api.RedissonClient; | ||
13 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
15 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; |
16 | import org.springframework.transaction.annotation.Transactional; | 14 | import org.springframework.transaction.annotation.Transactional; |
17 | import org.springframework.dao.EmptyResultDataAccessException; | 15 | import org.springframework.dao.EmptyResultDataAccessException; |
18 | import org.springframework.data.domain.Page; | ||
19 | import org.springframework.data.domain.Pageable; | ||
20 | import org.springframework.util.Assert; | 16 | import org.springframework.util.Assert; |
21 | import com.topdraw.utils.PageUtil; | ||
22 | import com.topdraw.utils.QueryHelp; | ||
23 | import com.topdraw.utils.StringUtils; | 17 | import com.topdraw.utils.StringUtils; |
24 | 18 | ||
25 | import java.util.List; | ||
26 | import java.util.Map; | ||
27 | 19 | ||
28 | /** | 20 | /** |
29 | * @author XiangHan | 21 | * @author XiangHan |
... | @@ -34,71 +26,56 @@ import java.util.Map; | ... | @@ -34,71 +26,56 @@ import java.util.Map; |
34 | public class ExpDetailServiceImpl implements ExpDetailService { | 26 | public class ExpDetailServiceImpl implements ExpDetailService { |
35 | 27 | ||
36 | @Autowired | 28 | @Autowired |
37 | private ExpDetailRepository ExpDetailRepository; | 29 | private ExpDetailRepository expDetailRepository; |
38 | |||
39 | @Autowired | 30 | @Autowired |
40 | private ExpDetailMapper ExpDetailMapper; | 31 | private ExpDetailMapper expDetailMapper; |
41 | 32 | ||
42 | @Autowired | 33 | @Autowired |
43 | private RedissonClient redissonClient; | 34 | private RedisUtils redisUtils; |
44 | |||
45 | @Override | ||
46 | public Map<String, Object> queryAll(ExpDetailQueryCriteria criteria, Pageable pageable) { | ||
47 | Page<ExpDetail> page = ExpDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
48 | return PageUtil.toPage(page.map(ExpDetailMapper::toDto)); | ||
49 | } | ||
50 | |||
51 | @Override | ||
52 | public List<ExpDetailDTO> queryAll(ExpDetailQueryCriteria criteria) { | ||
53 | return ExpDetailMapper.toDto(ExpDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
54 | } | ||
55 | 35 | ||
56 | @Override | 36 | @Override |
57 | public ExpDetailDTO findById(Long id) { | 37 | public ExpDetailDTO findById(Long id) { |
58 | ExpDetail ExpDetail = ExpDetailRepository.findById(id).orElseGet(ExpDetail::new); | 38 | ExpDetail ExpDetail = this.expDetailRepository.findById(id).orElseGet(ExpDetail::new); |
59 | ValidationUtil.isNull(ExpDetail.getId(),"ExpDetail","id",id); | 39 | ValidationUtil.isNull(ExpDetail.getId(),"ExpDetail","id",id); |
60 | return ExpDetailMapper.toDto(ExpDetail); | 40 | return this.expDetailMapper.toDto(ExpDetail); |
61 | } | 41 | } |
62 | 42 | ||
63 | @Override | 43 | @Override |
64 | @Transactional(rollbackFor = Exception.class) | 44 | @Transactional(rollbackFor = Exception.class) |
65 | @AsyncMqSend() | ||
66 | public void create(ExpDetail resources) { | 45 | public void create(ExpDetail resources) { |
67 | ExpDetailRepository.save(resources); | 46 | ExpDetail expDetail = ExpDetailBuilder.build(resources); |
47 | this.expDetailRepository.save(expDetail); | ||
68 | } | 48 | } |
69 | 49 | ||
70 | @Override | 50 | @Override |
71 | @Transactional(rollbackFor = Exception.class) | 51 | @Transactional(rollbackFor = Exception.class) |
72 | @AsyncMqSend() | ||
73 | public void update(ExpDetail resources) { | 52 | public void update(ExpDetail resources) { |
74 | RLock rLock = this.redissonClient.getLock(resources.getId().toString()); | 53 | this.redisUtils.doLock("expDetail::memberId::" + resources.getMemberId()); |
75 | try { | 54 | try { |
76 | ExpDetail ExpDetail = ExpDetailRepository.findById(resources.getId()).orElseGet(ExpDetail::new); | 55 | ExpDetail ExpDetail = this.expDetailRepository.findById(resources.getId()).orElseGet(ExpDetail::new); |
77 | ValidationUtil.isNull( ExpDetail.getId(),"ExpDetail","id",resources.getId()); | 56 | ValidationUtil.isNull( ExpDetail.getId(),"ExpDetail","id",resources.getId()); |
78 | ExpDetail.copy(resources); | 57 | ExpDetail.copy(resources); |
79 | ExpDetailRepository.save(ExpDetail); | 58 | this.expDetailRepository.save(ExpDetail); |
80 | } catch (Exception e) { | 59 | } catch (Exception e) { |
81 | e.printStackTrace(); | 60 | e.printStackTrace(); |
82 | throw e; | 61 | throw e; |
83 | } finally { | 62 | } finally { |
84 | rLock.unlock(); | 63 | this.redisUtils.doUnLock("expDetail::memberId::" + resources.getMemberId()); |
85 | } | 64 | } |
86 | } | 65 | } |
87 | 66 | ||
88 | @Override | 67 | @Override |
89 | @Transactional(rollbackFor = Exception.class) | 68 | @Transactional(rollbackFor = Exception.class) |
90 | @AsyncMqSend() | ||
91 | public void delete(Long id) { | 69 | public void delete(Long id) { |
92 | Assert.notNull(id, "The given id must not be null!"); | 70 | Assert.notNull(id, "The given id must not be null!"); |
93 | ExpDetail ExpDetail = ExpDetailRepository.findById(id).orElseThrow( | 71 | ExpDetail ExpDetail = this.expDetailRepository.findById(id).orElseThrow( |
94 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ExpDetail.class, id), 1)); | 72 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ExpDetail.class, id), 1)); |
95 | ExpDetailRepository.delete(ExpDetail); | 73 | this.expDetailRepository.delete(ExpDetail); |
96 | } | 74 | } |
97 | 75 | ||
98 | |||
99 | @Override | 76 | @Override |
100 | public ExpDetailDTO getByCode(String code) { | 77 | public ExpDetailDTO getByCode(String code) { |
101 | return StringUtils.isNotEmpty(code) ? ExpDetailMapper.toDto(ExpDetailRepository.findFirstByCode(code).orElseGet(ExpDetail::new)) | 78 | return StringUtils.isNotEmpty(code) ? this.expDetailMapper.toDto(this.expDetailRepository.findFirstByCode(code).orElseGet(ExpDetail::new)) |
102 | : new ExpDetailDTO(); | 79 | : new ExpDetailDTO(); |
103 | } | 80 | } |
104 | } | 81 | } | ... | ... |
1 | package com.topdraw.business.module.exp.history.domain; | ||
2 | |||
3 | import com.topdraw.exception.GlobeExceptionMsg; | ||
4 | import com.topdraw.util.IdWorker; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.util.Assert; | ||
7 | |||
8 | import java.util.Objects; | ||
9 | |||
10 | public class ExpHistoryBuilder { | ||
11 | |||
12 | public ExpHistory build(Long memberId, Long originalExp, Long resultExp, Long exp,Integer deviceType , Integer evtType) { | ||
13 | ExpHistory expHistory = new ExpHistory(); | ||
14 | expHistory.setMemberId(memberId); | ||
15 | expHistory.setOriginalExp(originalExp); | ||
16 | expHistory.setResultExp(resultExp); | ||
17 | expHistory.setDeviceType(deviceType); | ||
18 | expHistory.setEvtType(evtType); | ||
19 | expHistory.setExp(exp); | ||
20 | return build(expHistory); | ||
21 | } | ||
22 | |||
23 | public ExpHistory build(ExpHistory expHistory) { | ||
24 | return build(expHistory.getId(),expHistory.getCode(), | ||
25 | expHistory.getMemberId(),expHistory.getAccountId(), | ||
26 | expHistory.getOriginalExp(),expHistory.getResultExp(),expHistory.getExp(), | ||
27 | expHistory.getDeviceType(),expHistory.getEvtType(),expHistory.getOrderId(), | ||
28 | expHistory.getMediaId(),expHistory.getActivityId(),expHistory.getDescription()); | ||
29 | } | ||
30 | |||
31 | public ExpHistory build(Long id,String code,Long memberId,Long accountId, | ||
32 | Long originalExp,Long resultExp,Long exp, | ||
33 | Integer deviceType,Integer evtType,Long orderId, | ||
34 | Long mediaId,Long activityId,String description) { | ||
35 | |||
36 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
37 | |||
38 | ExpHistory expHistory = new ExpHistory(); | ||
39 | expHistory.setId(Objects.isNull(id)?null:id); | ||
40 | expHistory.setCode(StringUtils.isBlank(code)? IdWorker.generatorCode("exp") :code); | ||
41 | expHistory.setMemberId(memberId); | ||
42 | expHistory.setAccountId(Objects.isNull(accountId)?null:accountId); | ||
43 | expHistory.setOriginalExp(Objects.isNull(originalExp)?0L:originalExp); | ||
44 | expHistory.setResultExp(Objects.isNull(resultExp)?0L:resultExp); | ||
45 | expHistory.setExp(Objects.isNull(exp)?0L:exp); | ||
46 | expHistory.setDeviceType(Objects.isNull(deviceType)?4:deviceType); | ||
47 | expHistory.setEvtType(Objects.isNull(evtType)?98:evtType); | ||
48 | expHistory.setOrderId(Objects.isNull(orderId)?null:orderId); | ||
49 | expHistory.setMediaId(Objects.isNull(mediaId)?null:mediaId); | ||
50 | expHistory.setActivityId(Objects.isNull(activityId)?null:activityId); | ||
51 | expHistory.setDescription(StringUtils.isBlank(description)?null:description); | ||
52 | return expHistory; | ||
53 | } | ||
54 | |||
55 | |||
56 | } |
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 | } |
... | @@ -2,10 +2,6 @@ package com.topdraw.business.module.exp.history.service; | ... | @@ -2,10 +2,6 @@ package com.topdraw.business.module.exp.history.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.exp.history.domain.ExpHistory; | 3 | import com.topdraw.business.module.exp.history.domain.ExpHistory; |
4 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; | 4 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; |
5 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | ||
9 | 5 | ||
10 | /** | 6 | /** |
11 | * @author XiangHan | 7 | * @author XiangHan |
... | @@ -14,33 +10,18 @@ import java.util.List; | ... | @@ -14,33 +10,18 @@ import java.util.List; |
14 | public interface ExpHistoryService { | 10 | public interface ExpHistoryService { |
15 | 11 | ||
16 | /** | 12 | /** |
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 | /** | ||
32 | * 根据ID查询 | 13 | * 根据ID查询 |
33 | * @param id ID | 14 | * @param id ID |
34 | * @return ExpHistoryDTO | 15 | * @return ExpHistoryDTO |
35 | */ | 16 | */ |
36 | ExpHistoryDTO findById(Long id); | 17 | ExpHistoryDTO findById(Long id); |
37 | 18 | ||
19 | /** | ||
20 | * | ||
21 | * @param resources | ||
22 | */ | ||
38 | void create(ExpHistory resources); | 23 | void create(ExpHistory resources); |
39 | 24 | ||
40 | void update(ExpHistory resources); | ||
41 | |||
42 | void delete(Long id); | ||
43 | |||
44 | /** | 25 | /** |
45 | * Code校验 | 26 | * Code校验 |
46 | * @param code | 27 | * @param code | ... | ... |
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; | ||
16 | import org.springframework.data.domain.Page; | ||
17 | import org.springframework.data.domain.Pageable; | ||
18 | import org.springframework.util.Assert; | ||
19 | import com.topdraw.utils.PageUtil; | ||
20 | import com.topdraw.utils.QueryHelp; | ||
21 | import com.topdraw.utils.StringUtils; | 13 | import com.topdraw.utils.StringUtils; |
22 | 14 | ||
23 | import java.util.List; | ||
24 | import java.util.Map; | ||
25 | 15 | ||
26 | /** | 16 | /** |
27 | * @author XiangHan | 17 | * @author XiangHan |
... | @@ -32,60 +22,28 @@ import java.util.Map; | ... | @@ -32,60 +22,28 @@ import java.util.Map; |
32 | public class ExpHistoryServiceImpl implements ExpHistoryService { | 22 | public class ExpHistoryServiceImpl implements ExpHistoryService { |
33 | 23 | ||
34 | @Autowired | 24 | @Autowired |
35 | private ExpHistoryRepository ExpHistoryRepository; | 25 | private ExpHistoryMapper expHistoryMapper; |
36 | |||
37 | @Autowired | 26 | @Autowired |
38 | private ExpHistoryMapper ExpHistoryMapper; | 27 | private ExpHistoryRepository expHistoryRepository; |
39 | 28 | ||
40 | @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 | 29 | ||
51 | @Override | 30 | @Override |
52 | public ExpHistoryDTO findById(Long id) { | 31 | public ExpHistoryDTO findById(Long id) { |
53 | ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseGet(ExpHistory::new); | 32 | ExpHistory ExpHistory = this.expHistoryRepository.findById(id).orElseGet(ExpHistory::new); |
54 | ValidationUtil.isNull(ExpHistory.getId(),"ExpHistory","id",id); | 33 | ValidationUtil.isNull(ExpHistory.getId(),"ExpHistory","id",id); |
55 | return ExpHistoryMapper.toDto(ExpHistory); | 34 | return this.expHistoryMapper.toDto(ExpHistory); |
56 | } | 35 | } |
57 | 36 | ||
58 | @Override | 37 | @Override |
59 | @Transactional(rollbackFor = Exception.class) | 38 | @Transactional(rollbackFor = Exception.class) |
60 | @AsyncMqSend() | ||
61 | public void create(ExpHistory resources) { | 39 | public void create(ExpHistory resources) { |
62 | ExpHistoryRepository.save(resources); | 40 | this.expHistoryRepository.save(resources); |
63 | } | ||
64 | |||
65 | @Override | ||
66 | @Transactional(rollbackFor = Exception.class) | ||
67 | @AsyncMqSend() | ||
68 | public void update(ExpHistory resources) { | ||
69 | ExpHistory ExpHistory = ExpHistoryRepository.findById(resources.getId()).orElseGet(ExpHistory::new); | ||
70 | ValidationUtil.isNull( ExpHistory.getId(),"ExpHistory","id",resources.getId()); | ||
71 | ExpHistory.copy(resources); | ||
72 | ExpHistoryRepository.save(ExpHistory); | ||
73 | } | ||
74 | |||
75 | @Override | ||
76 | @Transactional(rollbackFor = Exception.class) | ||
77 | @AsyncMqSend() | ||
78 | public void delete(Long id) { | ||
79 | Assert.notNull(id, "The given id must not be null!"); | ||
80 | ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseThrow( | ||
81 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ExpHistory.class, id), 1)); | ||
82 | ExpHistoryRepository.delete(ExpHistory); | ||
83 | } | 41 | } |
84 | 42 | ||
85 | 43 | ||
86 | @Override | 44 | @Override |
87 | public ExpHistoryDTO getByCode(String code) { | 45 | public ExpHistoryDTO getByCode(String code) { |
88 | return StringUtils.isNotEmpty(code) ? ExpHistoryMapper.toDto(ExpHistoryRepository.findFirstByCode(code).orElseGet(ExpHistory::new)) | 46 | return StringUtils.isNotEmpty(code) ? this.expHistoryMapper.toDto(this.expHistoryRepository.findFirstByCode(code).orElseGet(ExpHistory::new)) |
89 | : new ExpHistoryDTO(); | 47 | : new ExpHistoryDTO(); |
90 | } | 48 | } |
91 | } | 49 | } | ... | ... |
1 | package com.topdraw.business.module.member.address.domain; | 1 | package com.topdraw.business.module.member.address.domain; |
2 | 2 | ||
3 | import com.topdraw.business.module.common.domain.AsyncMqModule; | ||
3 | import lombok.Data; | 4 | import lombok.Data; |
4 | import lombok.experimental.Accessors; | 5 | import lombok.experimental.Accessors; |
5 | import cn.hutool.core.bean.BeanUtil; | 6 | import cn.hutool.core.bean.BeanUtil; |
6 | import cn.hutool.core.bean.copier.CopyOptions; | 7 | import cn.hutool.core.bean.copier.CopyOptions; |
7 | import javax.persistence.*; | 8 | import javax.persistence.*; |
9 | |||
8 | import org.springframework.data.annotation.CreatedDate; | 10 | import org.springframework.data.annotation.CreatedDate; |
9 | import org.springframework.data.annotation.LastModifiedDate; | 11 | import org.springframework.data.annotation.LastModifiedDate; |
10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 12 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
11 | import java.sql.Timestamp; | ||
12 | 13 | ||
13 | import java.io.Serializable; | 14 | import java.io.Serializable; |
14 | import java.time.LocalDateTime; | 15 | import java.sql.Timestamp; |
15 | 16 | ||
16 | /** | 17 | /** |
17 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -22,81 +23,79 @@ import java.time.LocalDateTime; | ... | @@ -22,81 +23,79 @@ import java.time.LocalDateTime; |
22 | @EntityListeners(AuditingEntityListener.class) | 23 | @EntityListeners(AuditingEntityListener.class) |
23 | @Accessors(chain = true) | 24 | @Accessors(chain = true) |
24 | @Table(name="uc_member_address") | 25 | @Table(name="uc_member_address") |
25 | public class MemberAddress implements Serializable { | 26 | public class MemberAddress extends AsyncMqModule implements Serializable { |
26 | 27 | ||
27 | @Transient | 28 | @Transient |
28 | private String platformAccount; | 29 | private String platformAccount; |
29 | 30 | ||
30 | // 主键 | 31 | // 主键 |
32 | /** 主键 */ | ||
31 | @Id | 33 | @Id |
32 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 34 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
33 | @Column(name = "id") | 35 | @Column(name = "id") |
34 | private Long id; | 36 | private Long id; |
35 | 37 | ||
36 | // 会员id | 38 | /** 会员id */ |
37 | @Column(name = "member_id", nullable = false) | 39 | @Column(name = "member_id", nullable = false) |
38 | private Long memberId; | 40 | private Long memberId; |
39 | 41 | ||
40 | @Transient | 42 | /** 类型 1:家;2:公司;3:学校 */ |
41 | private String memberCode; | ||
42 | |||
43 | // 类型 1:家;2:公司;3:学校 | ||
44 | @Column(name = "type", nullable = false) | 43 | @Column(name = "type", nullable = false) |
45 | private Integer type; | 44 | private Integer type; |
46 | 45 | ||
47 | // 是否默认地址 | 46 | /** 是否默认地址 */ |
48 | @Column(name = "is_default", nullable = false) | 47 | @Column(name = "is_default", nullable = false) |
49 | private Integer isDefault; | 48 | private Integer isDefault; |
50 | 49 | ||
51 | // 显示顺序 | 50 | /** 显示顺序 */ |
52 | @Column(name = "sequence") | 51 | @Column(name = "sequence") |
53 | private Integer sequence; | 52 | private Integer sequence; |
54 | 53 | ||
55 | // 状态 0:不可用;1-可用 | 54 | /** 状态 0:不可用;1-可用 */ |
56 | @Column(name = "status", nullable = false) | 55 | @Column(name = "status", nullable = false) |
57 | private Integer status; | 56 | private Integer status; |
58 | 57 | ||
59 | // 联系人姓名 | 58 | /** 联系人姓名 */ |
60 | @Column(name = "contactor", nullable = false) | 59 | @Column(name = "contactor", nullable = false) |
61 | private String contactor; | 60 | private String contactor; |
62 | 61 | ||
63 | // 联系人电话 | 62 | /** 联系人电话 */ |
64 | @Column(name = "cellphone", nullable = false) | 63 | @Column(name = "cellphone", nullable = false) |
65 | private String cellphone; | 64 | private String cellphone; |
66 | 65 | ||
67 | // 国家 | 66 | /** 国家 */ |
68 | @Column(name = "country", nullable = false) | 67 | @Column(name = "country", nullable = false) |
69 | private String country; | 68 | private String country; |
70 | 69 | ||
71 | // 省份 | 70 | /** 省份 */ |
72 | @Column(name = "province", nullable = false) | 71 | @Column(name = "province", nullable = false) |
73 | private String province; | 72 | private String province; |
74 | 73 | ||
75 | // 城市 | 74 | /** 城市 */ |
76 | @Column(name = "city", nullable = false) | 75 | @Column(name = "city", nullable = false) |
77 | private String city; | 76 | private String city; |
78 | 77 | ||
79 | // 区县 | 78 | /** 区县 */ |
80 | @Column(name = "district", nullable = false) | 79 | @Column(name = "district", nullable = false) |
81 | private String district; | 80 | private String district; |
82 | 81 | ||
83 | // 地址 | 82 | /** 地址 */ |
84 | @Column(name = "address", nullable = false) | 83 | @Column(name = "address", nullable = false) |
85 | private String address; | 84 | private String address; |
86 | 85 | ||
87 | // 邮编 | 86 | /** 邮编 */ |
88 | @Column(name = "zip_code") | 87 | @Column(name = "zip_code") |
89 | private String zipCode; | 88 | private String zipCode; |
90 | 89 | ||
91 | // 创建时间 | 90 | /** 创建时间 */ |
92 | @CreatedDate | 91 | @CreatedDate |
93 | @Column(name = "create_time") | 92 | @Column(name = "create_time") |
94 | private LocalDateTime createTime; | 93 | private Timestamp createTime; |
95 | 94 | ||
96 | // 更新时间 | 95 | /** 更新时间 */ |
97 | @LastModifiedDate | 96 | @LastModifiedDate |
98 | @Column(name = "update_time") | 97 | @Column(name = "update_time") |
99 | private LocalDateTime updateTime; | 98 | private Timestamp updateTime; |
100 | 99 | ||
101 | public void copy(MemberAddress source){ | 100 | public void copy(MemberAddress source){ |
102 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | 101 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ... | ... |
1 | package com.topdraw.business.module.member.address.domain; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.exception.GlobeExceptionMsg; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.util.Assert; | ||
7 | |||
8 | import java.util.Objects; | ||
9 | |||
10 | /** | ||
11 | * @author : | ||
12 | * @description: | ||
13 | * @function : | ||
14 | * @date :Created in 2022/3/11 11:08 | ||
15 | * @version: : | ||
16 | * @modified By: | ||
17 | * @since : modified in 2022/3/11 11:08 | ||
18 | */ | ||
19 | public class MemberAddressBuilder { | ||
20 | |||
21 | private static final Integer DEFAULT_VALUE_0 = 0; | ||
22 | private static final Integer DEFAULT_VALUE_1 = 1; | ||
23 | |||
24 | public static MemberAddress build(MemberAddress memberAddress, Long memberId,String memberCode){ | ||
25 | Long id = memberAddress.getId(); | ||
26 | Integer type = memberAddress.getType(); | ||
27 | Integer isDefault = memberAddress.getIsDefault(); | ||
28 | Integer sequence = memberAddress.getSequence(); | ||
29 | Integer status= memberAddress.getStatus(); | ||
30 | String contactor = memberAddress.getContactor(); | ||
31 | String cellphone = memberAddress.getCellphone(); | ||
32 | String country = memberAddress.getCountry(); | ||
33 | String province = memberAddress.getProvince(); | ||
34 | String city = memberAddress.getCity(); | ||
35 | String district = memberAddress.getDistrict(); | ||
36 | String address = memberAddress.getAddress(); | ||
37 | String zipCode = memberAddress.getZipCode(); | ||
38 | return build(id,memberId,memberCode,type,isDefault,sequence,status, | ||
39 | contactor,cellphone,country,province,city,district,address,zipCode); | ||
40 | } | ||
41 | |||
42 | public static MemberAddress build(MemberAddress memberAddress, Member member){ | ||
43 | Long id = memberAddress.getId(); | ||
44 | Long memberId = member.getId(); | ||
45 | String memberCode = member.getCode(); | ||
46 | Integer type = memberAddress.getType(); | ||
47 | Integer isDefault = memberAddress.getIsDefault(); | ||
48 | Integer sequence = memberAddress.getSequence(); | ||
49 | Integer status= memberAddress.getStatus(); | ||
50 | String contactor = memberAddress.getContactor(); | ||
51 | String cellphone = memberAddress.getCellphone(); | ||
52 | String country = memberAddress.getCountry(); | ||
53 | String province = memberAddress.getProvince(); | ||
54 | String city = memberAddress.getCity(); | ||
55 | String district = memberAddress.getDistrict(); | ||
56 | String address = memberAddress.getAddress(); | ||
57 | String zipCode = memberAddress.getZipCode(); | ||
58 | return build(id, memberId, memberCode, type, isDefault, sequence, status, | ||
59 | contactor, cellphone, country, province, city, district, address, zipCode); | ||
60 | } | ||
61 | |||
62 | public static MemberAddress build(MemberAddress memberAddress){ | ||
63 | Long id = memberAddress.getId(); | ||
64 | Long memberId = memberAddress.getMemberId(); | ||
65 | String memberCode = memberAddress.getMemberCode(); | ||
66 | Integer type = memberAddress.getType(); | ||
67 | Integer isDefault = memberAddress.getIsDefault(); | ||
68 | Integer sequence = memberAddress.getSequence(); | ||
69 | Integer status= memberAddress.getStatus(); | ||
70 | String contactor = memberAddress.getContactor(); | ||
71 | String cellphone = memberAddress.getCellphone(); | ||
72 | String country = memberAddress.getCountry(); | ||
73 | String province = memberAddress.getProvince(); | ||
74 | String city = memberAddress.getCity(); | ||
75 | String district = memberAddress.getDistrict(); | ||
76 | String address = memberAddress.getAddress(); | ||
77 | String zipCode = memberAddress.getZipCode(); | ||
78 | return build(id, memberId, memberCode, type, isDefault, sequence, status, | ||
79 | contactor, cellphone, country, province, city, district, address, zipCode); | ||
80 | } | ||
81 | |||
82 | |||
83 | public static MemberAddress build(Long id , Long memberId,String memberCode, | ||
84 | Integer type ,Integer isDefault, Integer sequence, Integer status, | ||
85 | String contactor, String cellphone, | ||
86 | String country, String province, String city, | ||
87 | String district, String address, String zipCode){ | ||
88 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
89 | |||
90 | MemberAddress memberAddress = new MemberAddress(); | ||
91 | memberAddress.setId(Objects.isNull(id)?null:id); | ||
92 | memberAddress.setMemberId(Objects.isNull(memberId)?null:memberId); | ||
93 | memberAddress.setMemberCode(stringIsNull(memberCode)); | ||
94 | |||
95 | memberAddress.setSequence(Objects.isNull(sequence)?DEFAULT_VALUE_1:sequence); | ||
96 | memberAddress.setType(Objects.isNull(type)?DEFAULT_VALUE_0:type); | ||
97 | memberAddress.setIsDefault(Objects.isNull(isDefault)?DEFAULT_VALUE_0:isDefault); | ||
98 | memberAddress.setStatus(Objects.isNull(status)?DEFAULT_VALUE_1:status); | ||
99 | |||
100 | memberAddress.setContactor(stringIsNull(contactor)); | ||
101 | memberAddress.setCellphone(stringIsNull(cellphone)); | ||
102 | |||
103 | memberAddress.setCountry(stringIsNull(country)); | ||
104 | memberAddress.setProvince(stringIsNull(province)); | ||
105 | memberAddress.setCity(stringIsNull(city)); | ||
106 | memberAddress.setDistrict(stringIsNull(district)); | ||
107 | memberAddress.setAddress(stringIsNull(address)); | ||
108 | memberAddress.setZipCode(stringIsNull(zipCode)); | ||
109 | |||
110 | return memberAddress; | ||
111 | |||
112 | } | ||
113 | |||
114 | private static String stringIsNull(String s){ | ||
115 | return StringUtils.isBlank(s)?"":s; | ||
116 | } | ||
117 | |||
118 | } |
... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.repository; | ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.repository; |
3 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
4 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
6 | import org.springframework.data.jpa.repository.Query; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * @author XiangHan | 9 | * @author XiangHan |
... | @@ -10,4 +11,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ... | @@ -10,4 +11,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
10 | */ | 11 | */ |
11 | public interface MemberAddressRepository extends JpaRepository<MemberAddress, Long>, JpaSpecificationExecutor<MemberAddress> { | 12 | public interface MemberAddressRepository extends JpaRepository<MemberAddress, Long>, JpaSpecificationExecutor<MemberAddress> { |
12 | 13 | ||
14 | @Query(value = "select IFNULL(max(sequence),0) from uc_member_address where member_id = ?1" , nativeQuery = true) | ||
15 | int findMaxSequenceByMemberId(Long memberId); | ||
16 | |||
13 | } | 17 | } | ... | ... |
1 | package com.topdraw.business.module.member.address.rest; | 1 | package com.topdraw.business.module.member.address.rest; |
2 | 2 | ||
3 | import com.topdraw.annotation.AnonymousAccess; | 3 | import com.topdraw.annotation.AnonymousAccess; |
4 | import com.topdraw.business.module.member.service.MemberService; | 4 | import com.topdraw.business.module.common.validated.CreateGroup; |
5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 5 | import com.topdraw.business.module.common.validated.UpdateGroup; |
6 | import com.topdraw.business.module.member.address.service.dto.BasicMemberAddressDTO; | ||
7 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | ||
8 | import com.topdraw.business.process.service.member.MemberAddressOperationService; | ||
6 | import com.topdraw.common.ResultInfo; | 9 | import com.topdraw.common.ResultInfo; |
7 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 10 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
8 | import com.topdraw.business.module.member.address.service.MemberAddressService; | ||
9 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; | ||
10 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.data.domain.Pageable; | ||
13 | import org.springframework.util.Assert; | ||
14 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; |
15 | import org.springframework.web.bind.annotation.*; | 14 | import org.springframework.web.bind.annotation.*; |
16 | import io.swagger.annotations.*; | 15 | import io.swagger.annotations.*; |
17 | 16 | ||
18 | import java.util.Objects; | ||
19 | |||
20 | /** | 17 | /** |
21 | * @author XiangHan | 18 | * @author XiangHan |
22 | * @date 2021-10-22 | 19 | * @date 2021-10-22 |
23 | */ | 20 | */ |
24 | @Api(tags = "MemberAddress管理") | 21 | @Api(tags = "会员地址管理") |
25 | @RestController | 22 | @RestController |
26 | @RequestMapping("/ucEngine/api/memberAddress") | 23 | @RequestMapping("/uce/memberAddress") |
27 | @CrossOrigin | 24 | @CrossOrigin |
28 | @Slf4j | 25 | @Slf4j |
29 | public class MemberAddressController { | 26 | public class MemberAddressController { |
30 | 27 | ||
31 | @Autowired | 28 | @Autowired |
32 | private MemberAddressService MemberAddressService; | 29 | private MemberAddressOperationService memberAddressOperationService; |
33 | @Autowired | ||
34 | private MemberService memberService; | ||
35 | |||
36 | @GetMapping(value = "/pageMemberAddress") | ||
37 | @ApiOperation("查询MemberAddress") | ||
38 | public ResultInfo pageMemberAddress(MemberAddressQueryCriteria criteria, Pageable pageable) { | ||
39 | return ResultInfo.successPage(MemberAddressService.queryAll(criteria,pageable)); | ||
40 | } | ||
41 | |||
42 | @GetMapping(value = "/findById/{id}") | ||
43 | @ApiOperation("查询指定MemberAddress") | ||
44 | public ResultInfo findById(@PathVariable(value = "id") Long id) { | ||
45 | return ResultInfo.success(MemberAddressService.findById(id)); | ||
46 | } | ||
47 | 30 | ||
48 | @PostMapping(value = "/create") | 31 | @RequestMapping(value = "/create") |
49 | @ApiOperation("新增MemberAddress") | 32 | @ApiOperation("新增会员地址") |
50 | @AnonymousAccess | 33 | @AnonymousAccess |
51 | public ResultInfo create(@Validated @RequestBody MemberAddress resources) { | 34 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberAddress resources) { |
52 | log.info("MemberAddressController ==>> create ===>>[{}]",resources); | 35 | log.info("memberAddress ==>> create ==> param ==>> [{}]",resources); |
53 | 36 | BasicMemberAddressDTO memberAddressDTO = this.memberAddressOperationService.create(resources); | |
54 | Long memberId = resources.getMemberId(); | 37 | log.info("memberAddress ==>> create ==> result ==>> [{}]",resources); |
55 | MemberDTO memberDTO = this.memberService.findById(memberId); | 38 | return ResultInfo.success(memberAddressDTO); |
56 | String code = memberDTO.getCode(); | ||
57 | resources.setMemberCode(code); | ||
58 | MemberAddressService.create(resources); | ||
59 | return ResultInfo.success(); | ||
60 | } | 39 | } |
61 | 40 | ||
62 | @PutMapping(value = "/update") | 41 | @RequestMapping(value = "/update") |
63 | @ApiOperation("修改MemberAddress") | 42 | @ApiOperation("修改会员地址") |
64 | @AnonymousAccess | 43 | @AnonymousAccess |
65 | public ResultInfo update(@Validated @RequestBody MemberAddress resources) { | 44 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberAddress resources) { |
66 | 45 | log.info("memberAddress ==>> update ==> param ==>> [{}]",resources); | |
67 | log.info("MemberAddressController ==>> update ===>>[{}]",resources); | 46 | BasicMemberAddressDTO memberAddressDTO = this.memberAddressOperationService.update(resources); |
68 | 47 | log.info("memberAddress ==>> update ==> result ==>> [{}]",resources); | |
69 | Long memberId = resources.getMemberId(); | 48 | return ResultInfo.success(memberAddressDTO); |
70 | Integer sequence = resources.getSequence(); | ||
71 | Assert.notNull(memberId,"memberId can't be null"); | ||
72 | Assert.notNull(sequence,"sequence can't be null"); | ||
73 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
74 | if (Objects.nonNull(memberDTO)) { | ||
75 | String code = memberDTO.getCode(); | ||
76 | Assert.notNull(code,"code can't be null"); | ||
77 | resources.setMemberCode(code); | ||
78 | MemberAddressService.update(resources); | ||
79 | } | ||
80 | return ResultInfo.success(); | ||
81 | } | 49 | } |
82 | 50 | ||
83 | @DeleteMapping(value = "/delete/{id}") | 51 | @RequestMapping(value = "/delete") |
84 | @ApiOperation("删除MemberAddress") | 52 | @ApiOperation("删除会员地址") |
85 | @AnonymousAccess | 53 | @AnonymousAccess |
86 | public ResultInfo delete(@PathVariable Long id) { | 54 | public ResultInfo delete(@RequestParam(value = "id") Long resources) { |
87 | MemberAddressService.delete(id); | 55 | log.info("memberAddress ==>> delete ==> param ==>> [{}]",resources); |
56 | this.memberAddressOperationService.delete(resources); | ||
88 | return ResultInfo.success(); | 57 | return ResultInfo.success(); |
89 | } | 58 | } |
90 | 59 | ... | ... |
... | @@ -2,10 +2,6 @@ package com.topdraw.business.module.member.address.service; | ... | @@ -2,10 +2,6 @@ package com.topdraw.business.module.member.address.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
4 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | 4 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
5 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | ||
9 | 5 | ||
10 | /** | 6 | /** |
11 | * @author XiangHan | 7 | * @author XiangHan |
... | @@ -14,30 +10,34 @@ import java.util.List; | ... | @@ -14,30 +10,34 @@ import java.util.List; |
14 | public interface MemberAddressService { | 10 | public interface MemberAddressService { |
15 | 11 | ||
16 | /** | 12 | /** |
17 | * 查询数据分页 | 13 | * 根据ID查询 |
18 | * @param criteria 条件参数 | 14 | * @param resources ID |
19 | * @param pageable 分页参数 | 15 | * @return MemberAddressDTO |
20 | * @return Map<String,Object> | 16 | */ |
21 | */ | 17 | MemberAddressDTO findById(Long resources); |
22 | Map<String,Object> queryAll(MemberAddressQueryCriteria criteria, Pageable pageable); | ||
23 | 18 | ||
24 | /** | 19 | /** |
25 | * 查询所有数据不分页 | 20 | * 保存会员地址 |
26 | * @param criteria 条件参数 | 21 | * @param resources |
27 | * @return List<MemberAddressDTO> | 22 | */ |
28 | */ | 23 | MemberAddressDTO create(MemberAddress resources); |
29 | List<MemberAddressDTO> queryAll(MemberAddressQueryCriteria criteria); | ||
30 | 24 | ||
31 | /** | 25 | /** |
32 | * 根据ID查询 | 26 | * 修改会员地址 |
33 | * @param id ID | 27 | * @param resources |
34 | * @return MemberAddressDTO | ||
35 | */ | 28 | */ |
36 | MemberAddressDTO findById(Long id); | 29 | MemberAddressDTO update(MemberAddress resources); |
37 | 30 | ||
38 | void create(MemberAddress resources); | 31 | /** |
39 | 32 | * 通过id删除 | |
40 | void update(MemberAddress resources); | 33 | * @param resources |
34 | */ | ||
35 | void delete(Long resources); | ||
41 | 36 | ||
42 | void delete(Long id); | 37 | /** |
38 | * 地址最大序列号 | ||
39 | * @param memberId | ||
40 | * @return | ||
41 | */ | ||
42 | int findMaxSequenceByMemberId(Long memberId); | ||
43 | } | 43 | } | ... | ... |
1 | package com.topdraw.business.module.member.address.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | import java.time.LocalDateTime; | ||
7 | |||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2021-10-22 | ||
12 | */ | ||
13 | @Data | ||
14 | public class BasicMemberAddressDTO implements Serializable { | ||
15 | |||
16 | /** 主键 */ | ||
17 | private Long id; | ||
18 | |||
19 | /** 会员id */ | ||
20 | private Long memberId; | ||
21 | |||
22 | /** 类型 1:家;2:公司;3:学校 */ | ||
23 | private Integer type; | ||
24 | |||
25 | /** 是否默认地址 */ | ||
26 | private Integer isDefault; | ||
27 | |||
28 | /** 显示顺序 */ | ||
29 | private Integer sequence; | ||
30 | |||
31 | /** 状态 0:不可用;1-可用 */ | ||
32 | private Integer status; | ||
33 | |||
34 | /** 联系人姓名 */ | ||
35 | private String contactor; | ||
36 | |||
37 | /** 联系人电话 */ | ||
38 | private String cellphone; | ||
39 | |||
40 | /** 国家 */ | ||
41 | private String country; | ||
42 | |||
43 | /** 省份 */ | ||
44 | private String province; | ||
45 | |||
46 | /** 城市 */ | ||
47 | private String city; | ||
48 | |||
49 | /** 区县 */ | ||
50 | private String district; | ||
51 | |||
52 | /** 地址 */ | ||
53 | private String address; | ||
54 | |||
55 | /** 邮编 */ | ||
56 | private String zipCode; | ||
57 | } |
1 | package com.topdraw.business.module.member.address.service.dto; | 1 | package com.topdraw.business.module.member.address.service.dto; |
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | import java.sql.Timestamp; | ||
5 | import java.io.Serializable; | 4 | import java.io.Serializable; |
5 | import java.sql.Timestamp; | ||
6 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
7 | 7 | ||
8 | 8 | ||
... | @@ -13,51 +13,54 @@ import java.time.LocalDateTime; | ... | @@ -13,51 +13,54 @@ import java.time.LocalDateTime; |
13 | @Data | 13 | @Data |
14 | public class MemberAddressDTO implements Serializable { | 14 | public class MemberAddressDTO implements Serializable { |
15 | 15 | ||
16 | // 主键 | 16 | /** 会员code */ |
17 | private String memberCode; | ||
18 | |||
19 | /** 主键 */ | ||
17 | private Long id; | 20 | private Long id; |
18 | 21 | ||
19 | // 会员id | 22 | /** 会员id */ |
20 | private Long memberId; | 23 | private Long memberId; |
21 | 24 | ||
22 | // 类型 1:家;2:公司;3:学校 | 25 | /** 类型 1:家;2:公司;3:学校 */ |
23 | private Integer type; | 26 | private Integer type; |
24 | 27 | ||
25 | // 是否默认地址 | 28 | /** 是否默认地址 */ |
26 | private Integer isDefault; | 29 | private Integer isDefault; |
27 | 30 | ||
28 | // 显示顺序 | 31 | /** 显示顺序 */ |
29 | private Integer sequence; | 32 | private Integer sequence; |
30 | 33 | ||
31 | // 状态 0:不可用;1-可用 | 34 | /** 状态 0:不可用;1-可用 */ |
32 | private Integer status; | 35 | private Integer status; |
33 | 36 | ||
34 | // 联系人姓名 | 37 | /** 联系人姓名 */ |
35 | private String contactor; | 38 | private String contactor; |
36 | 39 | ||
37 | // 联系人电话 | 40 | /** 联系人电话 */ |
38 | private String cellphone; | 41 | private String cellphone; |
39 | 42 | ||
40 | // 国家 | 43 | /** 国家 */ |
41 | private String country; | 44 | private String country; |
42 | 45 | ||
43 | // 省份 | 46 | /** 省份 */ |
44 | private String province; | 47 | private String province; |
45 | 48 | ||
46 | // 城市 | 49 | /** 城市 */ |
47 | private String city; | 50 | private String city; |
48 | 51 | ||
49 | // 区县 | 52 | /** 区县 */ |
50 | private String district; | 53 | private String district; |
51 | 54 | ||
52 | // 地址 | 55 | /** 地址 */ |
53 | private String address; | 56 | private String address; |
54 | 57 | ||
55 | // 邮编 | 58 | /** 邮编 */ |
56 | private String zipCode; | 59 | private String zipCode; |
57 | 60 | ||
58 | // 创建时间 | 61 | /** 创建时间 */ |
59 | private LocalDateTime createTime; | 62 | private Timestamp createTime; |
60 | 63 | ||
61 | // 更新时间 | 64 | /** 更新时间 */ |
62 | private LocalDateTime updateTime; | 65 | private Timestamp updateTime; |
63 | } | 66 | } | ... | ... |
1 | package com.topdraw.business.module.member.address.service.impl; | 1 | package com.topdraw.business.module.member.address.service.impl; |
2 | 2 | ||
3 | import com.topdraw.aspect.AsyncMqSend; | ||
4 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
4 | import com.topdraw.business.module.member.address.domain.MemberAddressBuilder; | ||
5 | import com.topdraw.business.module.member.service.MemberService; | 5 | import com.topdraw.business.module.member.service.MemberService; |
6 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
7 | import com.topdraw.utils.RedisUtils; | ||
6 | import com.topdraw.utils.ValidationUtil; | 8 | import com.topdraw.utils.ValidationUtil; |
7 | import com.topdraw.business.module.member.address.repository.MemberAddressRepository; | 9 | import com.topdraw.business.module.member.address.repository.MemberAddressRepository; |
8 | import com.topdraw.business.module.member.address.service.MemberAddressService; | 10 | import com.topdraw.business.module.member.address.service.MemberAddressService; |
9 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | 11 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
10 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; | ||
11 | import com.topdraw.business.module.member.address.service.mapper.MemberAddressMapper; | 12 | import com.topdraw.business.module.member.address.service.mapper.MemberAddressMapper; |
13 | import lombok.extern.slf4j.Slf4j; | ||
14 | import org.springframework.beans.BeanUtils; | ||
12 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
14 | import org.springframework.transaction.annotation.Propagation; | 17 | import org.springframework.transaction.annotation.Propagation; |
15 | import org.springframework.transaction.annotation.Transactional; | 18 | import org.springframework.transaction.annotation.Transactional; |
16 | import org.springframework.dao.EmptyResultDataAccessException; | 19 | import org.springframework.dao.EmptyResultDataAccessException; |
17 | import org.springframework.data.domain.Page; | ||
18 | import org.springframework.data.domain.Pageable; | ||
19 | import org.springframework.util.Assert; | 20 | import org.springframework.util.Assert; |
20 | import com.topdraw.utils.PageUtil; | ||
21 | import com.topdraw.utils.QueryHelp; | ||
22 | |||
23 | import java.util.List; | ||
24 | import java.util.Map; | ||
25 | 21 | ||
26 | /** | 22 | /** |
27 | * @author XiangHan | 23 | * @author XiangHan |
... | @@ -29,58 +25,105 @@ import java.util.Map; | ... | @@ -29,58 +25,105 @@ import java.util.Map; |
29 | */ | 25 | */ |
30 | @Service | 26 | @Service |
31 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 27 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
28 | @Slf4j | ||
32 | public class MemberAddressServiceImpl implements MemberAddressService { | 29 | public class MemberAddressServiceImpl implements MemberAddressService { |
33 | 30 | ||
34 | @Autowired | 31 | @Autowired |
35 | private MemberAddressRepository MemberAddressRepository; | 32 | private MemberService memberService; |
36 | |||
37 | @Autowired | 33 | @Autowired |
38 | private MemberAddressMapper MemberAddressMapper; | 34 | private MemberAddressMapper memberAddressMapper; |
39 | 35 | @Autowired | |
40 | @Override | 36 | private MemberAddressRepository memberAddressRepository; |
41 | public Map<String, Object> queryAll(MemberAddressQueryCriteria criteria, Pageable pageable) { | ||
42 | Page<MemberAddress> page = MemberAddressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
43 | return PageUtil.toPage(page.map(MemberAddressMapper::toDto)); | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | public List<MemberAddressDTO> queryAll(MemberAddressQueryCriteria criteria) { | ||
48 | return MemberAddressMapper.toDto(MemberAddressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
49 | } | ||
50 | 37 | ||
38 | @Autowired | ||
39 | private RedisUtils redisUtils; | ||
40 | |||
51 | @Override | 41 | @Override |
52 | public MemberAddressDTO findById(Long id) { | 42 | public MemberAddressDTO findById(Long id) { |
53 | MemberAddress MemberAddress = MemberAddressRepository.findById(id).orElseGet(MemberAddress::new); | 43 | Assert.notNull(id,"id can't be null"); |
44 | MemberAddress MemberAddress = this.memberAddressRepository.findById(id).orElseGet(MemberAddress::new); | ||
54 | ValidationUtil.isNull(MemberAddress.getId(),"MemberAddress","id",id); | 45 | ValidationUtil.isNull(MemberAddress.getId(),"MemberAddress","id",id); |
55 | return MemberAddressMapper.toDto(MemberAddress); | 46 | return this.memberAddressMapper.toDto(MemberAddress); |
56 | } | 47 | } |
57 | 48 | ||
58 | @Override | 49 | @Override |
59 | @Transactional(rollbackFor = Exception.class) | 50 | @Transactional(rollbackFor = Exception.class) |
60 | @AsyncMqSend() | 51 | public MemberAddressDTO create(MemberAddress resources) { |
61 | public void create(MemberAddress resources) { | 52 | log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources); |
62 | MemberAddressRepository.save(resources); | 53 | MemberDTO memberDTO = this.checkMember(resources); |
54 | |||
55 | MemberAddress _memberAddress = MemberAddressBuilder.build(resources, memberDTO.getId(), memberDTO.getCode()); | ||
56 | MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress); | ||
57 | |||
58 | log.info("MemberAddressServiceImpl ==>> create ==>> result ==>> [{}]",resources); | ||
59 | MemberAddressDTO memberAddressDTO = new MemberAddressDTO(); | ||
60 | BeanUtils.copyProperties(memberAddress, memberAddressDTO); | ||
61 | return memberAddressDTO; | ||
62 | |||
63 | } | 63 | } |
64 | 64 | ||
65 | @Override | 65 | @Override |
66 | @Transactional(rollbackFor = Exception.class) | 66 | @Transactional(rollbackFor = Exception.class) |
67 | @AsyncMqSend() | 67 | public MemberAddressDTO update(MemberAddress resources) { |
68 | public void update(MemberAddress resources) { | 68 | log.info("MemberAddressServiceImpl ==>> update ==>> param ==>> [{}]",resources); |
69 | MemberAddress MemberAddress = MemberAddressRepository.findById(resources.getId()).orElseGet(MemberAddress::new); | 69 | Assert.notNull(resources.getId(),"id can't be null"); |
70 | ValidationUtil.isNull( MemberAddress.getId(),"MemberAddress","id",resources.getId()); | 70 | try { |
71 | MemberAddress.copy(resources); | 71 | this.redisUtils.doLock("memberAddress::memberId::" + resources.getMemberId()); |
72 | MemberAddressRepository.save(MemberAddress); | 72 | |
73 | MemberAddress _memberAddress = this.memberAddressRepository.findById(resources.getId()).orElseGet(MemberAddress::new); | ||
74 | ValidationUtil.isNull( _memberAddress.getId(),"MemberAddress","id",resources.getId()); | ||
75 | |||
76 | resources.setMemberId(_memberAddress.getMemberId()); | ||
77 | MemberDTO memberDTO = this.checkMember(resources); | ||
78 | resources.setMemberCode(memberDTO.getCode()); | ||
79 | |||
80 | _memberAddress.copy(resources); | ||
81 | MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress); | ||
82 | |||
83 | MemberAddressDTO memberAddressDTO = new MemberAddressDTO(); | ||
84 | BeanUtils.copyProperties(memberAddress, memberAddressDTO); | ||
85 | return memberAddressDTO; | ||
86 | } catch (Exception e) { | ||
87 | e.printStackTrace(); | ||
88 | throw e; | ||
89 | } finally { | ||
90 | this.redisUtils.doUnLock("memberAddress::memberId::" + resources.getMemberId()); | ||
91 | } | ||
73 | } | 92 | } |
74 | 93 | ||
75 | @Override | 94 | @Override |
76 | @Transactional(rollbackFor = Exception.class) | 95 | @Transactional(rollbackFor = Exception.class) |
77 | @AsyncMqSend() | ||
78 | public void delete(Long id) { | 96 | public void delete(Long id) { |
79 | Assert.notNull(id, "The given id must not be null!"); | 97 | Assert.notNull(id, "The given id must not be null!"); |
80 | MemberAddress MemberAddress = MemberAddressRepository.findById(id).orElseThrow( | 98 | MemberAddress MemberAddress = this.memberAddressRepository.findById(id).orElseThrow( |
81 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberAddress.class, id), 1)); | 99 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberAddress.class, id), 1)); |
82 | MemberAddressRepository.delete(MemberAddress); | 100 | this.memberAddressRepository.delete(MemberAddress); |
83 | } | 101 | } |
84 | 102 | ||
103 | @Override | ||
104 | public int findMaxSequenceByMemberId(Long memberId) { | ||
105 | return this.memberAddressRepository.findMaxSequenceByMemberId(memberId); | ||
106 | } | ||
107 | |||
108 | /** | ||
109 | * 检查会员 | ||
110 | * @param memberAddress | ||
111 | * @return | ||
112 | */ | ||
113 | private MemberDTO checkMember(MemberAddress memberAddress){ | ||
114 | Long memberId = memberAddress.getMemberId(); | ||
115 | String memberCode = memberAddress.getMemberCode(); | ||
116 | return this.checkMember(memberId,memberCode); | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * 检查会员 | ||
121 | * @param memberId 会员id | ||
122 | * @param memberCode 会员code | ||
123 | * @return | ||
124 | */ | ||
125 | private MemberDTO checkMember(Long memberId, String memberCode) { | ||
126 | return this.memberService.checkMember(memberId, memberCode); | ||
127 | } | ||
85 | 128 | ||
86 | } | 129 | } | ... | ... |
... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.domain; | ... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.domain; |
2 | 2 | ||
3 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | import cn.hutool.core.bean.copier.CopyOptions; | 4 | import cn.hutool.core.bean.copier.CopyOptions; |
5 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
5 | import lombok.Data; | 6 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 7 | import lombok.experimental.Accessors; |
7 | import org.springframework.data.annotation.CreatedDate; | 8 | import org.springframework.data.annotation.CreatedDate; |
... | @@ -9,9 +10,9 @@ import org.springframework.data.annotation.LastModifiedDate; | ... | @@ -9,9 +10,9 @@ import org.springframework.data.annotation.LastModifiedDate; |
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
10 | 11 | ||
11 | import javax.persistence.*; | 12 | import javax.persistence.*; |
13 | import javax.validation.constraints.NotNull; | ||
12 | import java.io.Serializable; | 14 | import java.io.Serializable; |
13 | import java.sql.Timestamp; | 15 | import java.sql.Timestamp; |
14 | import java.time.LocalDateTime; | ||
15 | 16 | ||
16 | /** | 17 | /** |
17 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -30,12 +31,13 @@ public class Member implements Serializable { | ... | @@ -30,12 +31,13 @@ public class Member implements Serializable { |
30 | 31 | ||
31 | /** 会员过期时间 */ | 32 | /** 会员过期时间 */ |
32 | @Column(name = "vip_expire_time", nullable = false) | 33 | @Column(name = "vip_expire_time", nullable = false) |
33 | private LocalDateTime vipExpireTime; | 34 | private Timestamp vipExpireTime; |
34 | 35 | ||
35 | /** 主键 */ | 36 | /** 主键 */ |
36 | @Id | 37 | @Id |
37 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 38 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
38 | @Column(name = "id") | 39 | @Column(name = "id") |
40 | @NotNull(message = "id can't be null!!",groups = {UpdateGroup.class}) | ||
39 | private Long id; | 41 | private Long id; |
40 | 42 | ||
41 | /** 标识 */ | 43 | /** 标识 */ |
... | @@ -116,17 +118,17 @@ public class Member implements Serializable { | ... | @@ -116,17 +118,17 @@ public class Member implements Serializable { |
116 | 118 | ||
117 | /** iptv账号绑定时间 */ | 119 | /** iptv账号绑定时间 */ |
118 | @Column(name = "bind_iptv_time") | 120 | @Column(name = "bind_iptv_time") |
119 | private LocalDateTime bindIptvTime; | 121 | private Timestamp bindIptvTime; |
120 | 122 | ||
121 | /** 创建时间 */ | 123 | /** 创建时间 */ |
122 | @CreatedDate | 124 | @CreatedDate |
123 | @Column(name = "create_time") | 125 | @Column(name = "create_time") |
124 | private LocalDateTime createTime; | 126 | private Timestamp createTime; |
125 | 127 | ||
126 | /** 更新时间 */ | 128 | /** 更新时间 */ |
127 | @LastModifiedDate | 129 | @LastModifiedDate |
128 | @Column(name = "update_time") | 130 | @Column(name = "update_time") |
129 | private LocalDateTime updateTime; | 131 | private Timestamp updateTime; |
130 | 132 | ||
131 | /** 是否在黑名单 1:是;0否 */ | 133 | /** 是否在黑名单 1:是;0否 */ |
132 | @Column(name = "black_status") | 134 | @Column(name = "black_status") | ... | ... |
1 | package com.topdraw.business.module.member.domain; | 1 | package com.topdraw.business.module.member.domain; |
2 | 2 | ||
3 | import cn.hutool.core.bean.BeanUtil; | ||
4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
5 | import com.topdraw.util.IdWorker; | 3 | import com.topdraw.util.IdWorker; |
6 | import lombok.Data; | 4 | import org.apache.commons.lang3.StringUtils; |
7 | import lombok.experimental.Accessors; | ||
8 | import org.springframework.data.annotation.CreatedDate; | ||
9 | import org.springframework.data.annotation.LastModifiedDate; | ||
10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
11 | 5 | ||
12 | import javax.persistence.*; | 6 | import java.util.Objects; |
13 | import java.io.Serializable; | ||
14 | import java.sql.Timestamp; | ||
15 | import java.time.LocalDateTime; | ||
16 | 7 | ||
17 | /** | 8 | /** |
18 | * @author XiangHan | 9 | * @author XiangHan |
... | @@ -20,22 +11,63 @@ import java.time.LocalDateTime; | ... | @@ -20,22 +11,63 @@ import java.time.LocalDateTime; |
20 | */ | 11 | */ |
21 | public class MemberBuilder { | 12 | public class MemberBuilder { |
22 | 13 | ||
23 | public static Member build(Integer type,String avatarUrl,String nickname,Integer vip){ | 14 | private static final Long DEFAULT_VALUE = 0L; |
15 | private static final Integer DEFAULT_VALUE_1 = 1; | ||
16 | private static final Integer DEFAULT_VALUE_ = -1; | ||
17 | |||
18 | public static Member build(Member member){ | ||
19 | Member _member = checkMemberData(member); | ||
20 | return _member; | ||
21 | } | ||
22 | |||
23 | private static Member checkMemberData(Member member) { | ||
24 | String code = member.getCode(); | ||
25 | member.setCode(StringUtils.isEmpty(code)?String.valueOf(IdWorker.generator()):code); | ||
26 | Integer gender = member.getGender(); | ||
27 | member.setGender(Objects.nonNull(gender) ? gender : DEFAULT_VALUE_); | ||
28 | Integer type = member.getType(); | ||
29 | member.setType(Objects.nonNull(type) ? type:DEFAULT_VALUE_); | ||
30 | Integer status = member.getStatus(); | ||
31 | member.setStatus(Objects.nonNull(status) ? status:DEFAULT_VALUE_1); | ||
32 | Integer vip = member.getVip(); | ||
33 | member.setVip(Objects.nonNull(vip) ? vip:0); | ||
34 | Integer level = member.getLevel(); | ||
35 | member.setLevel(Objects.nonNull(level) ? level:DEFAULT_VALUE_1); | ||
36 | member.setExp(DEFAULT_VALUE); | ||
37 | member.setPoints(DEFAULT_VALUE); | ||
38 | member.setDuePoints(DEFAULT_VALUE); | ||
39 | member.setCouponAmount(DEFAULT_VALUE); | ||
40 | member.setDueCouponAmount(DEFAULT_VALUE); | ||
41 | member.setBlackStatus(DEFAULT_VALUE); | ||
42 | member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday()); | ||
43 | /*String nickname = member.getNickname(); | ||
44 | if (StringUtils.isNotEmpty(nickname)) { | ||
45 | String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); | ||
46 | member.setNickname(base64Nickname); | ||
47 | }*/ | ||
48 | return member; | ||
49 | } | ||
50 | |||
51 | public static Member build(Integer type, String avatarUrl, String nickname, int vip){ | ||
52 | // todo 原型模式 | ||
53 | Member member = new Member(); | ||
54 | member.setType(type); | ||
55 | member.setAvatarUrl(avatarUrl); | ||
56 | member.setNickname(nickname); | ||
57 | member.setVip(vip); | ||
58 | Member _member = checkMemberData(member); | ||
59 | return _member; | ||
60 | } | ||
61 | |||
62 | public static Member build(Integer type, String avatarUrl, String nickname, int vip, Integer sex){ | ||
63 | // todo 原型模式 | ||
24 | Member member = new Member(); | 64 | Member member = new Member(); |
25 | member.setType(type); | 65 | member.setType(type); |
26 | member.setBlackStatus(0L); | ||
27 | member.setGender(-1); | ||
28 | member.setVip(vip==null?0:vip); | ||
29 | member.setLevel(1); | ||
30 | member.setStatus(1); | ||
31 | member.setPoints(0L); | ||
32 | member.setDuePoints(0L); | ||
33 | member.setExp(0L); | ||
34 | member.setCouponAmount(0L); | ||
35 | member.setDueCouponAmount(0L); | ||
36 | member.setAvatarUrl(avatarUrl); | 66 | member.setAvatarUrl(avatarUrl); |
37 | member.setCode(IdWorker.generator() + ""); | ||
38 | member.setNickname(nickname); | 67 | member.setNickname(nickname); |
39 | return member; | 68 | member.setVip(vip); |
69 | member.setGender(Objects.isNull(sex) == true ? -1:sex); | ||
70 | Member _member = checkMemberData(member); | ||
71 | return _member; | ||
40 | } | 72 | } |
41 | } | 73 | } | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/member/group/domain/Group.java
0 → 100644
1 | package com.topdraw.business.module.member.group.domain; | ||
2 | |||
3 | import cn.hutool.core.bean.BeanUtil; | ||
4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
5 | import lombok.Data; | ||
6 | import lombok.experimental.Accessors; | ||
7 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
8 | |||
9 | import javax.persistence.*; | ||
10 | import java.io.Serializable; | ||
11 | |||
12 | /** | ||
13 | * @author luerlong | ||
14 | * @date 2021-09-27 | ||
15 | */ | ||
16 | @Entity | ||
17 | @Data | ||
18 | @EntityListeners(AuditingEntityListener.class) | ||
19 | @Accessors(chain = true) | ||
20 | @Table(name="uc_group") | ||
21 | public class Group implements Serializable { | ||
22 | |||
23 | /** ID */ | ||
24 | @Id | ||
25 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
26 | @Column(name = "id") | ||
27 | private Long id; | ||
28 | |||
29 | /** CODE */ | ||
30 | @Column(name = "code") | ||
31 | private String code; | ||
32 | |||
33 | /** 名称 */ | ||
34 | @Column(name = "name") | ||
35 | private String name; | ||
36 | |||
37 | /** 状态 0-下线 1-上线 */ | ||
38 | @Column(name = "status") | ||
39 | private Integer status; | ||
40 | |||
41 | /** 权限 0-测试分组 1-鉴权通过(白名单) 2-不允许精准(黑名单)3-可以精准(金名单) */ | ||
42 | @Column(name = "permission_type") | ||
43 | private Integer permissionType; | ||
44 | |||
45 | public void copy(Group source){ | ||
46 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
47 | } | ||
48 | } |
... | @@ -23,58 +23,58 @@ import java.io.Serializable; | ... | @@ -23,58 +23,58 @@ import java.io.Serializable; |
23 | @Table(name="uc_member_group") | 23 | @Table(name="uc_member_group") |
24 | public class MemberGroup implements Serializable { | 24 | public class MemberGroup implements Serializable { |
25 | 25 | ||
26 | // ID ID | 26 | /** ID */ |
27 | @Id | 27 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 29 | @Column(name = "id") |
30 | private Long id; | 30 | private Long id; |
31 | 31 | ||
32 | // 分组ID | 32 | /** 分组ID */ |
33 | @Column(name = "group_id") | 33 | @Column(name = "group_id") |
34 | private Long groupId; | 34 | private Long groupId; |
35 | 35 | ||
36 | // 会员ID | 36 | /** 会员ID */ |
37 | @Column(name = "member_id") | 37 | @Column(name = "member_id") |
38 | private Long memberId; | 38 | private Long memberId; |
39 | 39 | ||
40 | // 运营商平台账号 | 40 | /** 运营商平台账号 */ |
41 | @Column(name = "platform_account") | 41 | @Column(name = "platform_account") |
42 | private String platformAccount; | 42 | private String platformAccount; |
43 | 43 | ||
44 | // 手机号 | 44 | /** 手机号 */ |
45 | @Column(name = "cellphone") | 45 | @Column(name = "cellphone") |
46 | private String cellphone; | 46 | private String cellphone; |
47 | 47 | ||
48 | // 设备 | 48 | /** 设备 */ |
49 | @Column(name = "stb_id") | 49 | @Column(name = "stb_id") |
50 | private String stbId; | 50 | private String stbId; |
51 | 51 | ||
52 | // 有线MAC地址 | 52 | /** 有线MAC地址 */ |
53 | @Column(name = "eth_mac") | 53 | @Column(name = "eth_mac") |
54 | private String ethMac; | 54 | private String ethMac; |
55 | 55 | ||
56 | // 无线MAC地址 | 56 | /** 无线MAC地址 */ |
57 | @Column(name = "wifi_mac") | 57 | @Column(name = "wifi_mac") |
58 | private String wifiMac; | 58 | private String wifiMac; |
59 | 59 | ||
60 | // 描述 | 60 | /** 描述 */ |
61 | @Column(name = "description") | 61 | @Column(name = "description") |
62 | private String description; | 62 | private String description; |
63 | 63 | ||
64 | // 创建者 | 64 | /** 创建者 */ |
65 | @Column(name = "create_by") | 65 | @Column(name = "create_by") |
66 | private String createBy; | 66 | private String createBy; |
67 | 67 | ||
68 | // 创建时间 | 68 | /** 创建时间 */ |
69 | @CreatedDate | 69 | @CreatedDate |
70 | @Column(name = "create_time") | 70 | @Column(name = "create_time") |
71 | private Timestamp createTime; | 71 | private Timestamp createTime; |
72 | 72 | ||
73 | // 更新者 | 73 | /** 更新者 */ |
74 | @Column(name = "update_by") | 74 | @Column(name = "update_by") |
75 | private String updateBy; | 75 | private String updateBy; |
76 | 76 | ||
77 | // 更新时间 | 77 | /** 更新时间 */ |
78 | @LastModifiedDate | 78 | @LastModifiedDate |
79 | @Column(name = "update_time") | 79 | @Column(name = "update_time") |
80 | private Timestamp updateTime; | 80 | private Timestamp updateTime; | ... | ... |
1 | package com.topdraw.business.module.member.group.repository; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.domain.Group; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | import org.springframework.data.jpa.repository.Query; | ||
7 | |||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | import java.util.Optional; | ||
11 | |||
12 | /** | ||
13 | * @author luerlong | ||
14 | * @date 2021-09-27 | ||
15 | */ | ||
16 | public interface GroupRepository extends JpaRepository<Group, Long>, JpaSpecificationExecutor<Group> { | ||
17 | |||
18 | Optional<Group> findFirstByCode(String code); | ||
19 | |||
20 | List<Group> findByName(String name); | ||
21 | |||
22 | @Query(value = "select t1.id from uc_group t1 left join uc_user__group t2 on t1.id = t2.group_id where t2.user_id = ?1 and t1.permission_type = ?2 ", nativeQuery = true) | ||
23 | List<Map<String, Object>> findByUserIdAndPermissionType(Long userId, Integer type); | ||
24 | } |
1 | package com.topdraw.business.module.member.group.repository; | 1 | package com.topdraw.business.module.member.group.repository; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.group.domain.MemberGroup; | 3 | import com.topdraw.business.module.member.group.domain.MemberGroup; |
4 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
6 | 7 | ||
8 | import java.util.List; | ||
9 | |||
7 | /** | 10 | /** |
8 | * @author XiangHan | 11 | * @author XiangHan |
9 | * @date 2021-11-17 | 12 | * @date 2021-11-17 |
10 | */ | 13 | */ |
11 | public interface MemberGroupRepository extends JpaRepository<MemberGroup, Long>, JpaSpecificationExecutor<MemberGroup> { | 14 | public interface MemberGroupRepository extends JpaRepository<MemberGroup, Long>, JpaSpecificationExecutor<MemberGroup> { |
12 | 15 | ||
16 | List<MemberGroupDTO> findByMemberId(Long memberId); | ||
13 | } | 17 | } | ... | ... |
1 | package com.topdraw.business.module.member.group.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.member.group.domain.MemberGroup; | ||
5 | import com.topdraw.business.module.member.group.service.MemberGroupService; | ||
6 | import com.topdraw.business.module.member.group.service.dto.MemberGroupQueryCriteria; | ||
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-11-17 | ||
16 | */ | ||
17 | @Api(tags = "MemberGroup管理") | ||
18 | @RestController | ||
19 | @RequestMapping("/api/MemberGroup") | ||
20 | public class MemberGroupController { | ||
21 | |||
22 | @Autowired | ||
23 | private MemberGroupService MemberGroupService; | ||
24 | |||
25 | @GetMapping | ||
26 | @ApiOperation("查询MemberGroup") | ||
27 | public ResultInfo getMemberGroups(MemberGroupQueryCriteria criteria, Pageable pageable) { | ||
28 | return ResultInfo.successPage(MemberGroupService.queryAll(criteria,pageable)); | ||
29 | } | ||
30 | |||
31 | @GetMapping(value = "/all") | ||
32 | @ApiOperation("查询所有MemberGroup") | ||
33 | public ResultInfo getMemberGroups(MemberGroupQueryCriteria criteria) { | ||
34 | return ResultInfo.success(MemberGroupService.queryAll(criteria)); | ||
35 | } | ||
36 | |||
37 | @PostMapping | ||
38 | @ApiOperation("新增MemberGroup") | ||
39 | public ResultInfo create(@Validated @RequestBody MemberGroup resources) { | ||
40 | MemberGroupService.create(resources); | ||
41 | return ResultInfo.success(); | ||
42 | } | ||
43 | |||
44 | @PutMapping | ||
45 | @ApiOperation("修改MemberGroup") | ||
46 | public ResultInfo update(@Validated @RequestBody MemberGroup resources) { | ||
47 | MemberGroupService.update(resources); | ||
48 | return ResultInfo.success(); | ||
49 | } | ||
50 | |||
51 | @DeleteMapping(value = "/{id}") | ||
52 | @ApiOperation("删除MemberGroup") | ||
53 | public ResultInfo delete(@PathVariable Long id) { | ||
54 | MemberGroupService.delete(id); | ||
55 | return ResultInfo.success(); | ||
56 | } | ||
57 | |||
58 | } |
member-service-impl/src/main/java/com/topdraw/business/module/member/group/service/GroupService.java
0 → 100644
1 | package com.topdraw.business.module.member.group.service; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.service.dto.GroupDTO; | ||
4 | |||
5 | |||
6 | /** | ||
7 | * @author luerlong | ||
8 | * @date 2021-09-27 | ||
9 | */ | ||
10 | public interface GroupService { | ||
11 | |||
12 | |||
13 | /** | ||
14 | * 根据ID查询 | ||
15 | * @param id ID | ||
16 | * @return GroupDTO | ||
17 | */ | ||
18 | GroupDTO findById(Long id); | ||
19 | |||
20 | /** | ||
21 | * Code校验 | ||
22 | * @param code | ||
23 | * @return GroupDTO | ||
24 | */ | ||
25 | GroupDTO getByCode(String code); | ||
26 | } |
... | @@ -2,9 +2,7 @@ package com.topdraw.business.module.member.group.service; | ... | @@ -2,9 +2,7 @@ package com.topdraw.business.module.member.group.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.group.domain.MemberGroup; | 3 | import com.topdraw.business.module.member.group.domain.MemberGroup; |
4 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; | 4 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; |
5 | import com.topdraw.business.module.member.group.service.dto.MemberGroupQueryCriteria; | 5 | |
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | 6 | import java.util.List; |
9 | 7 | ||
10 | /** | 8 | /** |
... | @@ -14,19 +12,11 @@ import java.util.List; | ... | @@ -14,19 +12,11 @@ import java.util.List; |
14 | public interface MemberGroupService { | 12 | public interface MemberGroupService { |
15 | 13 | ||
16 | /** | 14 | /** |
17 | * 查询数据分页 | 15 | * 通过会员id获取会员分组列表 |
18 | * @param criteria 条件参数 | 16 | * @param memberId |
19 | * @param pageable 分页参数 | 17 | * @return |
20 | * @return Map<String,Object> | 18 | */ |
21 | */ | 19 | List<MemberGroupDTO> findByMemberId(Long memberId); |
22 | Map<String,Object> queryAll(MemberGroupQueryCriteria criteria, Pageable pageable); | ||
23 | |||
24 | /** | ||
25 | * 查询所有数据不分页 | ||
26 | * @param criteria 条件参数 | ||
27 | * @return List<MemberGroupDTO> | ||
28 | */ | ||
29 | List<MemberGroupDTO> queryAll(MemberGroupQueryCriteria criteria); | ||
30 | 20 | ||
31 | /** | 21 | /** |
32 | * 根据ID查询 | 22 | * 根据ID查询 |
... | @@ -35,10 +25,4 @@ public interface MemberGroupService { | ... | @@ -35,10 +25,4 @@ public interface MemberGroupService { |
35 | */ | 25 | */ |
36 | MemberGroupDTO findById(Long id); | 26 | MemberGroupDTO findById(Long id); |
37 | 27 | ||
38 | void create(MemberGroup resources); | ||
39 | |||
40 | void update(MemberGroup resources); | ||
41 | |||
42 | void delete(Long id); | ||
43 | |||
44 | } | 28 | } | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/member/group/service/dto/GroupDTO.java
0 → 100644
1 | package com.topdraw.business.module.member.group.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | |||
7 | |||
8 | /** | ||
9 | * @author luerlong | ||
10 | * @date 2021-09-27 | ||
11 | */ | ||
12 | @Data | ||
13 | public class GroupDTO implements Serializable { | ||
14 | |||
15 | /** ID */ | ||
16 | private Long id; | ||
17 | |||
18 | /** CODE */ | ||
19 | private String code; | ||
20 | |||
21 | /** 名称 */ | ||
22 | private String name; | ||
23 | |||
24 | /** 状态 0-下线 1-上线 */ | ||
25 | private Integer status; | ||
26 | |||
27 | /** 权限 0-测试分组 1-鉴权通过(白名单) 2-不允许精准(黑名单)3-可以精准(金名单) */ | ||
28 | private Integer permissionType; | ||
29 | |||
30 | } |
... | @@ -12,42 +12,43 @@ import java.io.Serializable; | ... | @@ -12,42 +12,43 @@ import java.io.Serializable; |
12 | @Data | 12 | @Data |
13 | public class MemberGroupDTO implements Serializable { | 13 | public class MemberGroupDTO implements Serializable { |
14 | 14 | ||
15 | // ID ID | 15 | /** ID */ |
16 | private Long id; | 16 | private Long id; |
17 | 17 | ||
18 | // 分组ID | 18 | /** 分组ID */ |
19 | private Long groupId; | 19 | private Long groupId; |
20 | 20 | ||
21 | // 会员ID | 21 | /** 会员ID */ |
22 | private Long memberId; | 22 | private Long memberId; |
23 | 23 | ||
24 | // 运营商平台账号 | 24 | /** 运营商平台账号 */ |
25 | private String platformAccount; | 25 | private String platformAccount; |
26 | 26 | ||
27 | // 手机号 | 27 | /** 手机号 */ |
28 | private String cellphone; | 28 | private String cellphone; |
29 | 29 | ||
30 | // 设备 | 30 | /** 设备 */ |
31 | private String stbId; | 31 | private String stbId; |
32 | 32 | ||
33 | // 有线MAC地址 | 33 | /** 有线MAC地址 */ |
34 | private String ethMac; | 34 | private String ethMac; |
35 | 35 | ||
36 | // 无线MAC地址 | 36 | /** 无线MAC地址 */ |
37 | private String wifiMac; | 37 | private String wifiMac; |
38 | 38 | ||
39 | // 描述 | 39 | /** 描述 */ |
40 | private String description; | 40 | private String description; |
41 | 41 | ||
42 | // 创建者 | 42 | /** 创建者 */ |
43 | private String createBy; | 43 | private String createBy; |
44 | 44 | ||
45 | // 创建时间 | 45 | /** 创建时间 */ |
46 | private Timestamp createTime; | 46 | private Timestamp createTime; |
47 | 47 | ||
48 | // 更新者 | 48 | /** 更新者 */ |
49 | private String updateBy; | 49 | private String updateBy; |
50 | 50 | ||
51 | // 更新时间 | 51 | /** 更新时间 */ |
52 | private Timestamp updateTime; | 52 | private Timestamp updateTime; |
53 | |||
53 | } | 54 | } | ... | ... |
1 | package com.topdraw.business.module.member.group.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | import com.topdraw.annotation.Query; | ||
5 | |||
6 | /** | ||
7 | * @author XiangHan | ||
8 | * @date 2021-11-17 | ||
9 | */ | ||
10 | @Data | ||
11 | public class MemberGroupQueryCriteria{ | ||
12 | |||
13 | @Query(type = Query.Type.EQUAL) | ||
14 | private Long memberId; | ||
15 | } |
1 | package com.topdraw.business.module.member.group.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.domain.Group; | ||
4 | import com.topdraw.business.module.member.group.repository.GroupRepository; | ||
5 | import com.topdraw.business.module.member.group.service.GroupService; | ||
6 | import com.topdraw.business.module.member.group.service.dto.GroupDTO; | ||
7 | import com.topdraw.business.module.member.group.service.mapper.GroupMapper; | ||
8 | import com.topdraw.utils.*; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.stereotype.Service; | ||
11 | import org.springframework.transaction.annotation.Propagation; | ||
12 | import org.springframework.transaction.annotation.Transactional; | ||
13 | |||
14 | /** | ||
15 | * @author luerlong | ||
16 | * @date 2021-09-27 | ||
17 | */ | ||
18 | @Service | ||
19 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
20 | public class GroupServiceImpl implements GroupService { | ||
21 | |||
22 | @Autowired | ||
23 | private GroupRepository groupRepository; | ||
24 | |||
25 | @Autowired | ||
26 | private GroupMapper groupMapper; | ||
27 | |||
28 | @Override | ||
29 | public GroupDTO findById(Long id) { | ||
30 | Group group = groupRepository.findById(id).orElseGet(Group::new); | ||
31 | ValidationUtil.isNull(group.getId(),"Group","id",id); | ||
32 | return groupMapper.toDto(group); | ||
33 | } | ||
34 | |||
35 | @Override | ||
36 | public GroupDTO getByCode(String code) { | ||
37 | return StringUtils.isNotEmpty(code) ? groupMapper.toDto(groupRepository.findFirstByCode(code).orElseGet(Group::new)) | ||
38 | : new GroupDTO(); | ||
39 | } | ||
40 | } |
... | @@ -5,21 +5,13 @@ import com.topdraw.utils.ValidationUtil; | ... | @@ -5,21 +5,13 @@ import com.topdraw.utils.ValidationUtil; |
5 | import com.topdraw.business.module.member.group.repository.MemberGroupRepository; | 5 | import com.topdraw.business.module.member.group.repository.MemberGroupRepository; |
6 | import com.topdraw.business.module.member.group.service.MemberGroupService; | 6 | import com.topdraw.business.module.member.group.service.MemberGroupService; |
7 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; | 7 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; |
8 | import com.topdraw.business.module.member.group.service.dto.MemberGroupQueryCriteria; | ||
9 | import com.topdraw.business.module.member.group.service.mapper.MemberGroupMapper; | 8 | import com.topdraw.business.module.member.group.service.mapper.MemberGroupMapper; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
12 | import org.springframework.transaction.annotation.Propagation; | 11 | import org.springframework.transaction.annotation.Propagation; |
13 | import org.springframework.transaction.annotation.Transactional; | 12 | import org.springframework.transaction.annotation.Transactional; |
14 | import org.springframework.dao.EmptyResultDataAccessException; | ||
15 | import org.springframework.data.domain.Page; | ||
16 | import org.springframework.data.domain.Pageable; | ||
17 | import org.springframework.util.Assert; | ||
18 | import com.topdraw.utils.PageUtil; | ||
19 | import com.topdraw.utils.QueryHelp; | ||
20 | 13 | ||
21 | import java.util.List; | 14 | import java.util.List; |
22 | import java.util.Map; | ||
23 | 15 | ||
24 | /** | 16 | /** |
25 | * @author XiangHan | 17 | * @author XiangHan |
... | @@ -30,52 +22,20 @@ import java.util.Map; | ... | @@ -30,52 +22,20 @@ import java.util.Map; |
30 | public class MemberGroupServiceImpl implements MemberGroupService { | 22 | public class MemberGroupServiceImpl implements MemberGroupService { |
31 | 23 | ||
32 | @Autowired | 24 | @Autowired |
33 | private MemberGroupRepository MemberGroupRepository; | 25 | private MemberGroupRepository memberGroupRepository; |
34 | |||
35 | @Autowired | 26 | @Autowired |
36 | private MemberGroupMapper MemberGroupMapper; | 27 | private MemberGroupMapper memberGroupMapper; |
37 | |||
38 | @Override | ||
39 | public Map<String, Object> queryAll(MemberGroupQueryCriteria criteria, Pageable pageable) { | ||
40 | Page<MemberGroup> page = MemberGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
41 | return PageUtil.toPage(page.map(MemberGroupMapper::toDto)); | ||
42 | } | ||
43 | 28 | ||
44 | @Override | 29 | @Override |
45 | public List<MemberGroupDTO> queryAll(MemberGroupQueryCriteria criteria) { | 30 | public List<MemberGroupDTO> findByMemberId(Long memberId) { |
46 | return MemberGroupMapper.toDto(MemberGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | 31 | return this.memberGroupRepository.findByMemberId(memberId); |
47 | } | 32 | } |
48 | 33 | ||
49 | @Override | 34 | @Override |
50 | public MemberGroupDTO findById(Long id) { | 35 | public MemberGroupDTO findById(Long id) { |
51 | MemberGroup MemberGroup = MemberGroupRepository.findById(id).orElseGet(MemberGroup::new); | 36 | MemberGroup memberGroup = this.memberGroupRepository.findById(id).orElseGet(MemberGroup::new); |
52 | ValidationUtil.isNull(MemberGroup.getId(),"MemberGroup","id",id); | 37 | ValidationUtil.isNull(memberGroup.getId(),"MemberGroup","id",id); |
53 | return MemberGroupMapper.toDto(MemberGroup); | 38 | return this.memberGroupMapper.toDto(memberGroup); |
54 | } | ||
55 | |||
56 | @Override | ||
57 | @Transactional(rollbackFor = Exception.class) | ||
58 | public void create(MemberGroup resources) { | ||
59 | MemberGroupRepository.save(resources); | ||
60 | } | 39 | } |
61 | 40 | ||
62 | @Override | ||
63 | @Transactional(rollbackFor = Exception.class) | ||
64 | public void update(MemberGroup resources) { | ||
65 | MemberGroup MemberGroup = MemberGroupRepository.findById(resources.getId()).orElseGet(MemberGroup::new); | ||
66 | ValidationUtil.isNull( MemberGroup.getId(),"MemberGroup","id",resources.getId()); | ||
67 | MemberGroup.copy(resources); | ||
68 | MemberGroupRepository.save(MemberGroup); | ||
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 | MemberGroup MemberGroup = MemberGroupRepository.findById(id).orElseThrow( | ||
76 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberGroup.class, id), 1)); | ||
77 | MemberGroupRepository.delete(MemberGroup); | ||
78 | } | ||
79 | |||
80 | |||
81 | } | 41 | } | ... | ... |
1 | package com.topdraw.business.module.member.group.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.member.group.domain.Group; | ||
5 | import com.topdraw.business.module.member.group.service.dto.GroupDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author luerlong | ||
11 | * @date 2021-09-27 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface GroupMapper extends BaseMapper<GroupDTO, Group> { | ||
15 | |||
16 | } |
1 | package com.topdraw.business.module.member.level.domain; | 1 | package com.topdraw.business.module.member.level.domain; |
2 | 2 | ||
3 | import com.topdraw.business.module.common.validated.CreateGroup; | ||
4 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
3 | import lombok.Data; | 5 | import lombok.Data; |
4 | import lombok.experimental.Accessors; | 6 | import lombok.experimental.Accessors; |
5 | import cn.hutool.core.bean.BeanUtil; | 7 | import cn.hutool.core.bean.BeanUtil; |
6 | import cn.hutool.core.bean.copier.CopyOptions; | 8 | import cn.hutool.core.bean.copier.CopyOptions; |
7 | import javax.persistence.*; | 9 | import javax.persistence.*; |
10 | import javax.validation.constraints.Min; | ||
11 | import javax.validation.constraints.NotNull; | ||
12 | |||
8 | import org.springframework.data.annotation.CreatedDate; | 13 | import org.springframework.data.annotation.CreatedDate; |
9 | import org.springframework.data.annotation.LastModifiedDate; | 14 | import org.springframework.data.annotation.LastModifiedDate; |
10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 15 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
... | @@ -23,50 +28,53 @@ import java.io.Serializable; | ... | @@ -23,50 +28,53 @@ import java.io.Serializable; |
23 | @Table(name="uc_member_level") | 28 | @Table(name="uc_member_level") |
24 | public class MemberLevel implements Serializable { | 29 | public class MemberLevel implements Serializable { |
25 | 30 | ||
26 | // 主键 | 31 | /** 主键 */ |
27 | @Id | 32 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 33 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 34 | @Column(name = "id") |
35 | @NotNull(message = "id can't be null !!" , groups = {UpdateGroup.class}) | ||
30 | private Long id; | 36 | private Long id; |
31 | 37 | ||
32 | // 标识 | 38 | /** 标识 */ |
33 | @Column(name = "code", nullable = false) | 39 | @Column(name = "code", nullable = false) |
34 | private String code; | 40 | private String code; |
35 | 41 | ||
36 | // 名称 | 42 | /** 名称 */ |
37 | @Column(name = "name", nullable = false) | 43 | @Column(name = "name", nullable = false) |
38 | private String name; | 44 | private String name; |
39 | 45 | ||
40 | // 状态 0:未启用;1:启用 | 46 | /** 状态 0:未启用;1:启用 */ |
41 | @Column(name = "status", nullable = false) | 47 | @Column(name = "status", nullable = false) |
42 | private Integer status; | 48 | private Integer status; |
43 | 49 | ||
44 | // 对应成长值 | 50 | /** 对应成长值 */ |
45 | @Column(name = "exp_value", nullable = false) | 51 | @Column(name = "exp_value", nullable = false) |
46 | private Long expValue; | 52 | private Long expValue; |
47 | 53 | ||
48 | // 等级(不可重复,数字越大等级越高) | 54 | /** 等级(不可重复,数字越大等级越高) */ |
49 | @Column(name = "level", nullable = false) | 55 | @Column(name = "level", nullable = false) |
56 | @Min(message = "level can't less then 1" , value = 1) | ||
57 | @NotNull(message = "level can't be null" , groups = {CreateGroup.class,UpdateGroup.class}) | ||
50 | private Integer level; | 58 | private Integer level; |
51 | 59 | ||
52 | // 会员徽标 | 60 | /** 会员徽标 */ |
53 | @Column(name = "icon_url") | 61 | @Column(name = "icon_url") |
54 | private String iconUrl; | 62 | private String iconUrl; |
55 | 63 | ||
56 | // 描述 | 64 | /** 描述 */ |
57 | @Column(name = "description") | 65 | @Column(name = "description") |
58 | private String description; | 66 | private String description; |
59 | 67 | ||
60 | // 对应任务id,通过此字段可获得该等级所对应的权益 | 68 | /** 对应任务id,通过此字段可获得该等级所对应的权益 */ |
61 | @Column(name = "task_id") | 69 | @Column(name = "task_id") |
62 | private Long taskId; | 70 | private Long taskId; |
63 | 71 | ||
64 | // 创建时间 | 72 | /** 创建时间 */ |
65 | @CreatedDate | 73 | @CreatedDate |
66 | @Column(name = "create_time") | 74 | @Column(name = "create_time") |
67 | private Timestamp createTime; | 75 | private Timestamp createTime; |
68 | 76 | ||
69 | // 更新时间 | 77 | /** 更新时间 */ |
70 | @LastModifiedDate | 78 | @LastModifiedDate |
71 | @Column(name = "update_time") | 79 | @Column(name = "update_time") |
72 | private Timestamp updateTime; | 80 | private Timestamp updateTime; | ... | ... |
1 | package com.topdraw.business.module.member.level.rest; | ||
2 | |||
3 | import com.topdraw.common.ResultInfo; | ||
4 | import com.topdraw.business.module.member.level.service.MemberLevelService; | ||
5 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; | ||
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 = "MemberLevel管理") | ||
16 | @RestController | ||
17 | @RequestMapping("/api/MemberLevel") | ||
18 | public class MemberLevelController { | ||
19 | |||
20 | @Autowired | ||
21 | private MemberLevelService MemberLevelService; | ||
22 | |||
23 | @GetMapping | ||
24 | @ApiOperation("查询MemberLevel") | ||
25 | public ResultInfo getMemberLevels(MemberLevelQueryCriteria criteria, Pageable pageable) { | ||
26 | return ResultInfo.successPage(MemberLevelService.queryAll(criteria,pageable)); | ||
27 | } | ||
28 | |||
29 | @GetMapping(value = "/all") | ||
30 | @ApiOperation("查询所有MemberLevel") | ||
31 | public ResultInfo getMemberLevels(MemberLevelQueryCriteria criteria) { | ||
32 | return ResultInfo.success(MemberLevelService.queryAll(criteria)); | ||
33 | } | ||
34 | |||
35 | /*@Log | ||
36 | @PostMapping(value = "/create") | ||
37 | @ApiOperation("新增MemberLevel") | ||
38 | public ResultInfo create(@Validated @RequestBody MemberLevel resources) { | ||
39 | MemberLevelService.create(resources); | ||
40 | return ResultInfo.success(); | ||
41 | } | ||
42 | |||
43 | @Log | ||
44 | @PutMapping(value = "/update") | ||
45 | @ApiOperation("修改MemberLevel") | ||
46 | public ResultInfo update(@Validated @RequestBody MemberLevel resources) { | ||
47 | MemberLevelService.update(resources); | ||
48 | return ResultInfo.success(); | ||
49 | } | ||
50 | |||
51 | |||
52 | @Log | ||
53 | @DeleteMapping(value = "/delete/{id}") | ||
54 | @ApiOperation("删除MemberLevel") | ||
55 | public ResultInfo delete(@PathVariable Long id) { | ||
56 | MemberLevelService.delete(id); | ||
57 | return ResultInfo.success(); | ||
58 | }*/ | ||
59 | |||
60 | @GetMapping(value = "/getByCode/{code}") | ||
61 | @ApiOperation(value = "根据标识查询") | ||
62 | public ResultInfo getByCode(@PathVariable String code) { | ||
63 | return ResultInfo.success(MemberLevelService.getByCode(code)); | ||
64 | } | ||
65 | } |
1 | package com.topdraw.business.module.member.level.service; | 1 | package com.topdraw.business.module.member.level.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.level.domain.MemberLevel; | ||
4 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; | 3 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
5 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; | 4 | |
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | 5 | import java.util.List; |
9 | 6 | ||
10 | /** | 7 | /** |
... | @@ -14,33 +11,12 @@ import java.util.List; | ... | @@ -14,33 +11,12 @@ import java.util.List; |
14 | public interface MemberLevelService { | 11 | public interface MemberLevelService { |
15 | 12 | ||
16 | /** | 13 | /** |
17 | * 查询数据分页 | ||
18 | * @param criteria 条件参数 | ||
19 | * @param pageable 分页参数 | ||
20 | * @return Map<String,Object> | ||
21 | */ | ||
22 | Map<String,Object> queryAll(MemberLevelQueryCriteria criteria, Pageable pageable); | ||
23 | |||
24 | /** | ||
25 | * 查询所有数据不分页 | ||
26 | * @param criteria 条件参数 | ||
27 | * @return List<MemberLevelDTO> | ||
28 | */ | ||
29 | List<MemberLevelDTO> queryAll(MemberLevelQueryCriteria criteria); | ||
30 | |||
31 | /** | ||
32 | * 根据ID查询 | 14 | * 根据ID查询 |
33 | * @param id ID | 15 | * @param id ID |
34 | * @return MemberLevelDTO | 16 | * @return MemberLevelDTO |
35 | */ | 17 | */ |
36 | MemberLevelDTO findById(Long id); | 18 | MemberLevelDTO findById(Long id); |
37 | 19 | ||
38 | void create(MemberLevel resources); | ||
39 | |||
40 | void update(MemberLevel resources); | ||
41 | |||
42 | void delete(Long id); | ||
43 | |||
44 | /** | 20 | /** |
45 | * Code校验 | 21 | * Code校验 |
46 | * @param code | 22 | * @param code |
... | @@ -48,5 +24,13 @@ public interface MemberLevelService { | ... | @@ -48,5 +24,13 @@ public interface MemberLevelService { |
48 | */ | 24 | */ |
49 | MemberLevelDTO getByCode(String code); | 25 | MemberLevelDTO getByCode(String code); |
50 | 26 | ||
27 | /** | ||
28 | * 通过等级和状态检索 | ||
29 | * @param i | ||
30 | * @param status | ||
31 | * @return | ||
32 | */ | ||
51 | List<MemberLevelDTO> findLevelAndStatus(Integer i, Integer status); | 33 | List<MemberLevelDTO> findLevelAndStatus(Integer i, Integer status); |
34 | |||
35 | |||
52 | } | 36 | } | ... | ... |
... | @@ -12,36 +12,36 @@ import java.io.Serializable; | ... | @@ -12,36 +12,36 @@ import java.io.Serializable; |
12 | @Data | 12 | @Data |
13 | public class MemberLevelDTO implements Serializable { | 13 | public class MemberLevelDTO implements Serializable { |
14 | 14 | ||
15 | // 主键 | 15 | /** 主键 */ |
16 | private Long id; | 16 | private Long id; |
17 | 17 | ||
18 | // 标识 | 18 | /** 标识 */ |
19 | private String code; | 19 | private String code; |
20 | 20 | ||
21 | // 名称 | 21 | /** 名称 */ |
22 | private String name; | 22 | private String name; |
23 | 23 | ||
24 | // 状态 0:未启用;1:启用 | 24 | /** 状态 0:未启用;1:启用 */ |
25 | private Integer status; | 25 | private Integer status; |
26 | 26 | ||
27 | // 对应成长值 | 27 | /** 对应成长值 */ |
28 | private Long expValue; | 28 | private Long expValue; |
29 | 29 | ||
30 | // 等级(不可重复,数字越大等级越高) | 30 | /** 等级(不可重复,数字越大等级越高) */ |
31 | private Integer level; | 31 | private Integer level; |
32 | 32 | ||
33 | // 会员徽标 | 33 | /** 会员徽标 */ |
34 | private String iconUrl; | 34 | private String iconUrl; |
35 | 35 | ||
36 | // 描述 | 36 | /** 描述 */ |
37 | private String description; | 37 | private String description; |
38 | 38 | ||
39 | // 对应任务id,通过此字段可获得该等级所对应的权益 | 39 | /** 对应任务id,通过此字段可获得该等级所对应的权益 */ |
40 | private Long taskId; | 40 | private Long taskId; |
41 | 41 | ||
42 | // 创建时间 | 42 | /** 创建时间 */ |
43 | private Timestamp createTime; | 43 | private Timestamp createTime; |
44 | 44 | ||
45 | // 更新时间 | 45 | /** 更新时间 */ |
46 | private Timestamp updateTime; | 46 | private Timestamp updateTime; |
47 | } | 47 | } | ... | ... |
1 | package com.topdraw.business.module.member.level.service.impl; | 1 | package com.topdraw.business.module.member.level.service.impl; |
2 | 2 | ||
3 | import com.topdraw.aspect.AsyncMqSend; | ||
4 | import com.topdraw.business.module.member.level.domain.MemberLevel; | 3 | import com.topdraw.business.module.member.level.domain.MemberLevel; |
5 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
6 | import com.topdraw.business.module.member.level.repository.MemberLevelRepository; | 5 | import com.topdraw.business.module.member.level.repository.MemberLevelRepository; |
7 | import com.topdraw.business.module.member.level.service.MemberLevelService; | 6 | import com.topdraw.business.module.member.level.service.MemberLevelService; |
8 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; | 7 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
9 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; | ||
10 | import com.topdraw.business.module.member.level.service.mapper.MemberLevelMapper; | 8 | import com.topdraw.business.module.member.level.service.mapper.MemberLevelMapper; |
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; | ||
16 | import org.springframework.data.domain.Page; | ||
17 | import org.springframework.data.domain.Pageable; | ||
18 | import org.springframework.util.Assert; | ||
19 | import com.topdraw.utils.PageUtil; | ||
20 | import com.topdraw.utils.QueryHelp; | ||
21 | import com.topdraw.utils.StringUtils; | 13 | import com.topdraw.utils.StringUtils; |
22 | 14 | ||
23 | import java.util.List; | 15 | import java.util.List; |
24 | import java.util.Map; | ||
25 | 16 | ||
26 | /** | 17 | /** |
27 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -32,65 +23,27 @@ import java.util.Map; | ... | @@ -32,65 +23,27 @@ import java.util.Map; |
32 | public class MemberLevelServiceImpl implements MemberLevelService { | 23 | public class MemberLevelServiceImpl implements MemberLevelService { |
33 | 24 | ||
34 | @Autowired | 25 | @Autowired |
35 | private MemberLevelRepository MemberLevelRepository; | 26 | private MemberLevelRepository memberLevelRepository; |
36 | 27 | ||
37 | @Autowired | 28 | @Autowired |
38 | private MemberLevelMapper MemberLevelMapper; | 29 | private MemberLevelMapper memberLevelMapper; |
39 | |||
40 | @Override | ||
41 | public Map<String, Object> queryAll(MemberLevelQueryCriteria criteria, Pageable pageable) { | ||
42 | Page<MemberLevel> page = MemberLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
43 | return PageUtil.toPage(page.map(MemberLevelMapper::toDto)); | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | public List<MemberLevelDTO> queryAll(MemberLevelQueryCriteria criteria) { | ||
48 | return MemberLevelMapper.toDto(MemberLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
49 | } | ||
50 | 30 | ||
51 | @Override | 31 | @Override |
52 | public MemberLevelDTO findById(Long id) { | 32 | public MemberLevelDTO findById(Long id) { |
53 | MemberLevel MemberLevel = MemberLevelRepository.findById(id).orElseGet(MemberLevel::new); | 33 | MemberLevel MemberLevel = this.memberLevelRepository.findById(id).orElseGet(MemberLevel::new); |
54 | ValidationUtil.isNull(MemberLevel.getId(),"MemberLevel","id",id); | 34 | ValidationUtil.isNull(MemberLevel.getId(),"MemberLevel","id",id); |
55 | return MemberLevelMapper.toDto(MemberLevel); | 35 | return this.memberLevelMapper.toDto(MemberLevel); |
56 | } | ||
57 | |||
58 | @Override | ||
59 | @Transactional(rollbackFor = Exception.class) | ||
60 | @AsyncMqSend() | ||
61 | public void create(MemberLevel resources) { | ||
62 | MemberLevelRepository.save(resources); | ||
63 | } | 36 | } |
64 | 37 | ||
65 | @Override | 38 | @Override |
66 | @Transactional(rollbackFor = Exception.class) | ||
67 | @AsyncMqSend() | ||
68 | public void update(MemberLevel resources) { | ||
69 | MemberLevel MemberLevel = MemberLevelRepository.findById(resources.getId()).orElseGet(MemberLevel::new); | ||
70 | ValidationUtil.isNull( MemberLevel.getId(),"MemberLevel","id",resources.getId()); | ||
71 | MemberLevel.copy(resources); | ||
72 | MemberLevelRepository.save(MemberLevel); | ||
73 | } | ||
74 | |||
75 | @Override | ||
76 | @Transactional(rollbackFor = Exception.class) | ||
77 | @AsyncMqSend() | ||
78 | public void delete(Long id) { | ||
79 | Assert.notNull(id, "The given id must not be null!"); | ||
80 | MemberLevel MemberLevel = MemberLevelRepository.findById(id).orElseThrow( | ||
81 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberLevel.class, id), 1)); | ||
82 | MemberLevelRepository.delete(MemberLevel); | ||
83 | } | ||
84 | |||
85 | |||
86 | @Override | ||
87 | public MemberLevelDTO getByCode(String code) { | 39 | public MemberLevelDTO getByCode(String code) { |
88 | return StringUtils.isNotEmpty(code) ? MemberLevelMapper.toDto(MemberLevelRepository.findFirstByCode(code).orElseGet(MemberLevel::new)) | 40 | return StringUtils.isNotEmpty(code) ? this.memberLevelMapper.toDto(this.memberLevelRepository.findFirstByCode(code).orElseGet(MemberLevel::new)) |
89 | : new MemberLevelDTO(); | 41 | : new MemberLevelDTO(); |
90 | } | 42 | } |
91 | 43 | ||
92 | @Override | 44 | @Override |
93 | public List<MemberLevelDTO> findLevelAndStatus(Integer level, Integer status) { | 45 | public List<MemberLevelDTO> findLevelAndStatus(Integer level, Integer status) { |
94 | return MemberLevelMapper.toDto(MemberLevelRepository.findByLevelAndStatus(level,status)); | 46 | return this.memberLevelMapper.toDto(this.memberLevelRepository.findByLevelAndStatus(level,status)); |
95 | } | 47 | } |
48 | |||
96 | } | 49 | } | ... | ... |
1 | package com.topdraw.business.module.member.profile.domain; | 1 | package com.topdraw.business.module.member.profile.domain; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.profile.DoSaveMemberProfileGroup; | 3 | import com.topdraw.business.module.common.validated.CreateGroup; |
4 | import com.topdraw.business.module.member.profile.DoUpdateMemberProfileGroup; | 4 | import com.topdraw.business.module.common.validated.UpdateGroup; |
5 | import lombok.Data; | 5 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 6 | import lombok.experimental.Accessors; |
7 | import cn.hutool.core.bean.BeanUtil; | 7 | import cn.hutool.core.bean.BeanUtil; |
... | @@ -27,82 +27,81 @@ import java.io.Serializable; | ... | @@ -27,82 +27,81 @@ import java.io.Serializable; |
27 | @Table(name="uc_member_profile") | 27 | @Table(name="uc_member_profile") |
28 | public class MemberProfile implements Serializable { | 28 | public class MemberProfile implements Serializable { |
29 | 29 | ||
30 | /** 会员code */ | ||
30 | @Transient | 31 | @Transient |
32 | // @NotNull(message = "memberCode not be null!!" , groups = {CreateGroup.class,UpdateGroup.class}) | ||
31 | private String memberCode; | 33 | private String memberCode; |
32 | 34 | ||
33 | // 主键 | 35 | /** 头像 */ |
36 | @Transient | ||
37 | private String avatarUrl; | ||
38 | |||
39 | /** 主键 */ | ||
34 | @Id | 40 | @Id |
35 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 41 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
36 | @Column(name = "id") | 42 | @Column(name = "id") |
37 | @NotNull(message = "【id】 not be null!!" , groups = DoUpdateMemberProfileGroup.class) | 43 | @NotNull(message = "id not be null!!" , groups = UpdateGroup.class) |
38 | private Long id; | 44 | private Long id; |
39 | 45 | ||
40 | // 会员id | 46 | /** 会员id */ |
41 | @NotNull(message = "【memberId】 not be null!!" , groups = DoSaveMemberProfileGroup.class) | ||
42 | @Column(name = "member_id", nullable = false) | 47 | @Column(name = "member_id", nullable = false) |
48 | @NotNull(message = "memberId not be null!!" , groups = {CreateGroup.class}) | ||
43 | private Long memberId; | 49 | private Long memberId; |
44 | 50 | ||
45 | // 姓名 | 51 | /** 姓名 */ |
46 | @Column(name = "realname") | 52 | @Column(name = "realname") |
47 | private String realname; | 53 | private String realname; |
48 | 54 | ||
49 | // 性别 0:女; 1:男 -1:未知 | 55 | /** 性别 0:女; 1:男 -1:未知 */ |
50 | @Column(name = "gender", nullable = false) | 56 | @Column(name = "gender", nullable = false) |
51 | @NotNull(message = "【gender】 not be null!!" , groups = {DoSaveMemberProfileGroup.class}) | ||
52 | private Integer gender; | 57 | private Integer gender; |
53 | 58 | ||
54 | // 生日 | 59 | /** 生日 */ |
55 | @NotNull(message = "【memberId】 not be null!!" , groups = DoSaveMemberProfileGroup.class) | ||
56 | @Column(name = "birthday", nullable = false) | 60 | @Column(name = "birthday", nullable = false) |
57 | private String birthday; | 61 | private String birthday; |
58 | 62 | ||
59 | // 手机号 | 63 | /** 手机号 */ |
60 | @Column(name = "phone") | 64 | @Column(name = "phone") |
61 | private String phone; | 65 | private String phone; |
62 | 66 | ||
63 | // 星座 | 67 | /** 星座 */ |
64 | @Column(name = "constellation") | 68 | @Column(name = "constellation") |
65 | private String constellation; | 69 | private String constellation; |
66 | 70 | ||
67 | // 身份证 | 71 | /** 身份证 */ |
68 | @NotNull(message = "【idCard】 not be null!!" , groups = DoSaveMemberProfileGroup.class) | ||
69 | @Column(name = "id_card", nullable = false) | 72 | @Column(name = "id_card", nullable = false) |
70 | private String idCard; | 73 | private String idCard; |
71 | 74 | ||
72 | // 电子邮件 | 75 | /** 电子邮件 */ |
73 | @Column(name = "email") | 76 | @Column(name = "email") |
74 | private String email; | 77 | private String email; |
75 | 78 | ||
76 | // 国家 | 79 | /** 国家 */ |
77 | @Column(name = "country") | 80 | @Column(name = "country") |
78 | private String country; | 81 | private String country; |
79 | 82 | ||
80 | // 省份 | 83 | /** 省份 */ |
81 | @Column(name = "province") | 84 | @Column(name = "province") |
82 | private String province; | 85 | private String province; |
83 | 86 | ||
84 | // 城市 | 87 | /** 城市 */ |
85 | @Column(name = "city") | 88 | @Column(name = "city") |
86 | private String city; | 89 | private String city; |
87 | 90 | ||
88 | // 区县 | 91 | /** 区县 */ |
89 | @Column(name = "district") | 92 | @Column(name = "district") |
90 | private String district; | 93 | private String district; |
91 | 94 | ||
92 | //头像 | 95 | /** 描述 */ |
93 | @Transient | ||
94 | private String avatarUrl; | ||
95 | |||
96 | // 描述 | ||
97 | @Column(name = "description") | 96 | @Column(name = "description") |
98 | private String description; | 97 | private String description; |
99 | 98 | ||
100 | // 创建时间 | 99 | /** 创建时间 */ |
101 | @CreatedDate | 100 | @CreatedDate |
102 | @Column(name = "create_time") | 101 | @Column(name = "create_time") |
103 | private Timestamp createTime; | 102 | private Timestamp createTime; |
104 | 103 | ||
105 | // 更新时间 | 104 | /** 更新时间 */ |
106 | @LastModifiedDate | 105 | @LastModifiedDate |
107 | @Column(name = "update_time") | 106 | @Column(name = "update_time") |
108 | private Timestamp updateTime; | 107 | private Timestamp updateTime; | ... | ... |
1 | package com.topdraw.business.module.member.profile.domain; | ||
2 | |||
3 | |||
4 | import com.topdraw.utils.StringUtils; | ||
5 | |||
6 | import java.sql.Timestamp; | ||
7 | import java.util.Objects; | ||
8 | |||
9 | public class MemberProfileBuild { | ||
10 | |||
11 | public static MemberProfile build(Long memberId , String realname , Integer gender, String birthday){ | ||
12 | MemberProfile memberProfile = build(memberId,realname,gender,"","","","","","", | ||
13 | "","","",birthday); | ||
14 | return memberProfile; | ||
15 | } | ||
16 | |||
17 | public static MemberProfile build(){ | ||
18 | MemberProfile memberProfile = build(null,"",null,"","","","","","", | ||
19 | "","","",null); | ||
20 | return memberProfile; | ||
21 | } | ||
22 | |||
23 | public static MemberProfile build(Long memberId, String realName, Integer sex, | ||
24 | String contry, String district, String city, String idCard, String province, | ||
25 | String email, String description, String phone, String constellation, | ||
26 | String timestamp) { | ||
27 | |||
28 | if (memberId == null) | ||
29 | throw new NullPointerException("memberId is null"); | ||
30 | |||
31 | MemberProfile memberProfile = new MemberProfile(); | ||
32 | memberProfile.setMemberId(memberId); | ||
33 | memberProfile.setRealname(stringIsNull(realName)); | ||
34 | memberProfile.setGender(sex == null ? 0 : sex); | ||
35 | memberProfile.setCountry(stringIsNull(contry)); | ||
36 | memberProfile.setDistrict(stringIsNull(district)); | ||
37 | memberProfile.setCity(stringIsNull(city)); | ||
38 | memberProfile.setIdCard(stringIsNull(idCard)); | ||
39 | memberProfile.setProvince(stringIsNull(province)); | ||
40 | memberProfile.setEmail(stringIsNull(email)); | ||
41 | memberProfile.setDescription(stringIsNull(description)); | ||
42 | memberProfile.setPhone(stringIsNull(phone)); | ||
43 | memberProfile.setConstellation(stringIsNull(constellation)); | ||
44 | memberProfile.setBirthday(StringUtils.isNotBlank(timestamp) ? timestamp : "1900-01-01"); | ||
45 | |||
46 | return memberProfile; | ||
47 | } | ||
48 | |||
49 | private static String stringIsNull(String s){ | ||
50 | return StringUtils.isBlank(s)?"":s; | ||
51 | } | ||
52 | |||
53 | private static Object objectIsNull(Object s){ | ||
54 | return Objects.nonNull(s)?null:s; | ||
55 | } | ||
56 | |||
57 | } |
1 | package com.topdraw.business.module.member.profile.domain; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.exception.GlobeExceptionMsg; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.util.Assert; | ||
7 | |||
8 | import java.util.Objects; | ||
9 | |||
10 | public class MemberProfileBuilder { | ||
11 | |||
12 | public static MemberProfile build(Member member){ | ||
13 | MemberProfile memberProfile = build(member.getId(),member.getCode(),member.getNickname(),member.getGender(),"","","","","","", | ||
14 | "","","",member.getBirthday()); | ||
15 | return memberProfile; | ||
16 | } | ||
17 | |||
18 | public static MemberProfile build(Long memberId){ | ||
19 | MemberProfile memberProfile = build(memberId,"","",-1,"","","","","","", | ||
20 | "","","",""); | ||
21 | return memberProfile; | ||
22 | } | ||
23 | |||
24 | public static MemberProfile build(Long memberId ,String memberCode, String realname , Integer gender, String birthday){ | ||
25 | MemberProfile memberProfile = build(memberId,memberCode,realname,gender,"","","","","","", | ||
26 | "","","",birthday); | ||
27 | return memberProfile; | ||
28 | } | ||
29 | |||
30 | public static MemberProfile build(Long memberId,String memberCode, String realName, Integer sex, | ||
31 | String country, String district, String city, String idCard, String province, | ||
32 | String email, String description, String phone, String constellation, | ||
33 | String birthday) { | ||
34 | |||
35 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
36 | |||
37 | MemberProfile memberProfile = new MemberProfile(); | ||
38 | memberProfile.setMemberId(memberId); | ||
39 | memberProfile.setMemberCode(memberCode); | ||
40 | memberProfile.setRealname(stringIsNull(realName)); | ||
41 | memberProfile.setGender(sex == null ? 0 : sex); | ||
42 | memberProfile.setCountry(StringUtils.isBlank(country)?"中国":birthday); | ||
43 | memberProfile.setDistrict(stringIsNull(district)); | ||
44 | memberProfile.setCity(stringIsNull(city)); | ||
45 | memberProfile.setIdCard(StringUtils.isBlank(idCard)?"000000000000000000":idCard); | ||
46 | memberProfile.setProvince(stringIsNull(province)); | ||
47 | memberProfile.setEmail(stringIsNull(email)); | ||
48 | memberProfile.setDescription(stringIsNull(description)); | ||
49 | memberProfile.setPhone(stringIsNull(phone)); | ||
50 | memberProfile.setConstellation(stringIsNull(constellation)); | ||
51 | memberProfile.setBirthday(StringUtils.isBlank(birthday)?"1900-01-01":birthday); | ||
52 | |||
53 | return memberProfile; | ||
54 | } | ||
55 | |||
56 | private static String stringIsNull(String s){ | ||
57 | return StringUtils.isBlank(s)?"":s; | ||
58 | } | ||
59 | |||
60 | public static MemberProfile build(MemberProfile resources) { | ||
61 | if (resources.getMemberId() == null) | ||
62 | throw new NullPointerException("memberId is null"); | ||
63 | |||
64 | MemberProfile memberProfile = new MemberProfile(); | ||
65 | memberProfile.setId(resources.getId()); | ||
66 | memberProfile.setMemberId(resources.getMemberId()); | ||
67 | memberProfile.setRealname(stringIsNull(resources.getRealname())); | ||
68 | memberProfile.setGender(resources.getGender() == null ? -1 : resources.getGender()); | ||
69 | memberProfile.setCountry(stringIsNull(resources.getCountry())); | ||
70 | memberProfile.setDistrict(stringIsNull(resources.getDistrict())); | ||
71 | memberProfile.setCity(stringIsNull(resources.getCity())); | ||
72 | memberProfile.setIdCard(StringUtils.isBlank(resources.getIdCard()) ? "000000000000000000":resources.getIdCard()); | ||
73 | memberProfile.setProvince(stringIsNull(resources.getProvince())); | ||
74 | memberProfile.setEmail(stringIsNull(resources.getEmail())); | ||
75 | memberProfile.setDescription(stringIsNull(resources.getDescription())); | ||
76 | memberProfile.setPhone(stringIsNull(resources.getPhone())); | ||
77 | memberProfile.setConstellation(stringIsNull(resources.getConstellation())); | ||
78 | memberProfile.setBirthday(Objects.isNull(resources.getBirthday()) ? "1900-01-01" : resources.getBirthday()); | ||
79 | return memberProfile; | ||
80 | } | ||
81 | } |
1 | package com.topdraw.business.module.member.profile.rest; | 1 | package com.topdraw.business.module.member.profile.rest; |
2 | 2 | ||
3 | import com.topdraw.annotation.AnonymousAccess; | 3 | import com.topdraw.annotation.AnonymousAccess; |
4 | import com.topdraw.business.module.common.validated.CreateGroup; | ||
5 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
5 | import com.topdraw.business.module.member.service.MemberService; | 7 | import com.topdraw.business.process.service.member.MemberProfileOperationService; |
6 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
7 | import com.topdraw.common.ResultInfo; | 8 | import com.topdraw.common.ResultInfo; |
8 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 9 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
9 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 10 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
10 | import com.topdraw.util.Base64Util; | ||
11 | import com.topdraw.utils.StringUtils; | ||
12 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.util.Assert; | ||
15 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; |
16 | import org.springframework.web.bind.annotation.*; | 14 | import org.springframework.web.bind.annotation.*; |
17 | import io.swagger.annotations.*; | 15 | import io.swagger.annotations.*; |
18 | 16 | ||
19 | import java.util.Objects; | ||
20 | 17 | ||
21 | /** | 18 | /** |
22 | * @author XiangHan | 19 | * @author XiangHan |
23 | * @date 2021-10-22 | 20 | * @date 2021-10-22 |
24 | */ | 21 | */ |
25 | @Api(tags = "MemberProfile管理") | 22 | @Api(tags = "会员属性管理") |
26 | @RestController | 23 | @RestController |
27 | @RequestMapping("/ucEngine/api/memberProfile") | 24 | @RequestMapping("/uce/memberProfile") |
28 | @CrossOrigin | 25 | @CrossOrigin |
29 | @Slf4j | 26 | @Slf4j |
30 | public class MemberProfileController { | 27 | public class MemberProfileController { |
31 | 28 | ||
32 | @Autowired | 29 | @Autowired |
33 | private MemberProfileService MemberProfileService; | 30 | private MemberProfileOperationService memberProfileOperationService; |
34 | @Autowired | ||
35 | private MemberService memberService; | ||
36 | |||
37 | /*@GetMapping | ||
38 | @ApiOperation("查询MemberProfile") | ||
39 | public ResultInfo getMemberProfiles(MemberProfileQueryCriteria criteria, Pageable pageable) { | ||
40 | return ResultInfo.successPage(MemberProfileService.queryAll(criteria,pageable)); | ||
41 | } | ||
42 | 31 | ||
43 | @GetMapping(value = "/all") | 32 | @RequestMapping(value = "/update") |
44 | @ApiOperation("查询所有MemberProfile") | 33 | @ApiOperation("修改会员属性") |
45 | public ResultInfo getMemberProfiles(MemberProfileQueryCriteria criteria) { | ||
46 | return ResultInfo.success(MemberProfileService.queryAll(criteria)); | ||
47 | }*/ | ||
48 | |||
49 | @PostMapping(value = "/create") | ||
50 | @ApiOperation("新增MemberProfile") | ||
51 | @AnonymousAccess | 34 | @AnonymousAccess |
52 | public ResultInfo create(@Validated @RequestBody MemberProfile resources) { | 35 | @Deprecated |
53 | log.info("MemberProfileServiceImpl ==>> create ==>> resources ===>> [{}]",resources); | 36 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberProfile resources) { |
54 | String realname = resources.getRealname(); | 37 | |
55 | MemberProfileService.create(resources); | 38 | log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); |
56 | return ResultInfo.success(); | 39 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources); |
40 | return ResultInfo.success(memberProfileDTO); | ||
57 | } | 41 | } |
58 | 42 | ||
59 | @PutMapping(value = "/update") | 43 | @PutMapping(value = "/updateMemberProfileAndMember") |
60 | @ApiOperation("修改MemberProfile") | 44 | @ApiOperation("修改会员属性并同步会员信息") |
61 | @AnonymousAccess | 45 | @AnonymousAccess |
62 | public ResultInfo update(@Validated @RequestBody MemberProfile resources) { | 46 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { |
63 | |||
64 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | 47 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); |
65 | 48 | ||
66 | Long memberId = resources.getMemberId(); | 49 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources); |
67 | Assert.notNull(memberId,"memberId can't be null"); | 50 | return ResultInfo.success(memberProfileDTO); |
68 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
69 | if (Objects.nonNull(memberDTO)) { | ||
70 | String code = memberDTO.getCode(); | ||
71 | if (StringUtils.isNotEmpty(code)) { | ||
72 | resources.setMemberCode(code); | ||
73 | MemberProfileDTO memberProfile = this.MemberProfileService.findByMemberId(memberId); | ||
74 | if (Objects.nonNull(memberProfile)) { | ||
75 | resources.setId(memberProfile.getId()); | ||
76 | MemberProfileService.update(resources); | ||
77 | } else { | ||
78 | resources.setId(null); | ||
79 | this.create(resources); | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | return ResultInfo.success(); | ||
84 | } | 51 | } |
85 | 52 | ||
86 | @PutMapping | 53 | @RequestMapping(value = "/create") |
87 | @ApiOperation("修改MemberProfile") | 54 | @ApiOperation("新增会员属性") |
88 | @AnonymousAccess | 55 | @AnonymousAccess |
89 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { | 56 | @Deprecated |
90 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | 57 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberProfile resources) { |
91 | this.MemberProfileService.updateMemberProfileAndMember(resources); | ||
92 | return ResultInfo.success(); | ||
93 | } | ||
94 | 58 | ||
95 | @DeleteMapping(value = "/delete/{id}") | 59 | log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); |
96 | @ApiOperation("删除MemberProfile") | ||
97 | public ResultInfo delete(@PathVariable Long id) { | ||
98 | MemberProfileService.delete(id); | ||
99 | return ResultInfo.success(); | ||
100 | } | ||
101 | 60 | ||
61 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.createMemberProfileAndSyncMember(resources); | ||
62 | return ResultInfo.success(memberProfileDTO); | ||
63 | } | ||
102 | } | 64 | } | ... | ... |
1 | package com.topdraw.business.module.member.profile.service; | 1 | package com.topdraw.business.module.member.profile.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.domain.Member; | ||
3 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; | 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
6 | import org.springframework.data.domain.Pageable; | ||
7 | import java.util.Map; | ||
8 | import java.util.List; | ||
9 | 7 | ||
10 | /** | 8 | /** |
11 | * @author XiangHan | 9 | * @author XiangHan |
... | @@ -14,36 +12,69 @@ import java.util.List; | ... | @@ -14,36 +12,69 @@ import java.util.List; |
14 | public interface MemberProfileService { | 12 | public interface MemberProfileService { |
15 | 13 | ||
16 | /** | 14 | /** |
17 | * 查询数据分页 | ||
18 | * @param criteria 条件参数 | ||
19 | * @param pageable 分页参数 | ||
20 | * @return Map<String,Object> | ||
21 | */ | ||
22 | Map<String,Object> queryAll(MemberProfileQueryCriteria criteria, Pageable pageable); | ||
23 | |||
24 | /** | ||
25 | * 查询所有数据不分页 | ||
26 | * @param criteria 条件参数 | ||
27 | * @return List<MemberProfileDTO> | ||
28 | */ | ||
29 | List<MemberProfileDTO> queryAll(MemberProfileQueryCriteria criteria); | ||
30 | |||
31 | /** | ||
32 | * 根据ID查询 | 15 | * 根据ID查询 |
33 | * @param id ID | 16 | * @param id ID |
34 | * @return MemberProfileDTO | 17 | * @return MemberProfileDTO |
35 | */ | 18 | */ |
36 | MemberProfileDTO findById(Long id); | 19 | MemberProfileDTO findById(Long id); |
37 | 20 | ||
38 | MemberProfile create(MemberProfile resources); | 21 | /** |
22 | * 保存 | ||
23 | * @param resources 会员基本信息 | ||
24 | * @return | ||
25 | */ | ||
26 | MemberProfileDTO create(MemberProfile resources); | ||
39 | 27 | ||
40 | MemberProfile createDefault(MemberProfile resources); | 28 | /** |
29 | * 默认属性 | ||
30 | * @param resources | ||
31 | * @return | ||
32 | */ | ||
33 | MemberProfileDTO createDefault(MemberProfile resources); | ||
34 | |||
35 | /** | ||
36 | * 通过会员创建默认属性 | ||
37 | * @param resources | ||
38 | * @return | ||
39 | */ | ||
40 | MemberProfileDTO createDefault(Member resources); | ||
41 | 41 | ||
42 | void update(MemberProfile resources); | 42 | /** |
43 | * 通过会员id创建默认属性 | ||
44 | * @param resources | ||
45 | * @return | ||
46 | */ | ||
47 | MemberProfileDTO createDefaultByMemberId(Long resources); | ||
43 | 48 | ||
49 | /** | ||
50 | * 修改 | ||
51 | * @param resources | ||
52 | */ | ||
53 | MemberProfileDTO update(MemberProfile resources); | ||
54 | |||
55 | /** | ||
56 | * 删除 | ||
57 | * @param id | ||
58 | */ | ||
44 | void delete(Long id); | 59 | void delete(Long id); |
45 | 60 | ||
61 | /** | ||
62 | * 通过会员id查询 | ||
63 | * @param memberId | ||
64 | * @return | ||
65 | */ | ||
46 | MemberProfileDTO findByMemberId(Long memberId); | 66 | MemberProfileDTO findByMemberId(Long memberId); |
47 | 67 | ||
48 | void updateMemberProfileAndMember(MemberProfile resources); | 68 | /** |
69 | * 通过会员code查询 | ||
70 | * @param memberCode | ||
71 | * @return | ||
72 | */ | ||
73 | MemberProfileDTO findByMemberCode(String memberCode); | ||
74 | |||
75 | /** | ||
76 | * 修改会员属性并同步会员信息 | ||
77 | * @param resources | ||
78 | */ | ||
79 | MemberProfileDTO updateMemberProfileAndMember(MemberProfile resources, MemberDTO memberDTO); | ||
49 | } | 80 | } | ... | ... |
... | @@ -12,63 +12,63 @@ import java.io.Serializable; | ... | @@ -12,63 +12,63 @@ import java.io.Serializable; |
12 | @Data | 12 | @Data |
13 | public class MemberProfileDTO implements Serializable { | 13 | public class MemberProfileDTO implements Serializable { |
14 | 14 | ||
15 | // 主键 | 15 | /** 会员code */ |
16 | private String memberCode; | ||
17 | |||
18 | /** 主键 */ | ||
16 | private Long id; | 19 | private Long id; |
17 | 20 | ||
18 | // 会员id | 21 | /** 会员id */ |
19 | private Long memberId; | 22 | private Long memberId; |
20 | 23 | ||
21 | // 姓名 | 24 | /** 姓名 */ |
22 | private String realname; | 25 | private String realname; |
23 | 26 | ||
24 | private String nickname; | 27 | /** 性别 0:女; 1:男 -1:未知 */ |
25 | |||
26 | // 性别 0:女; 1:男 -1:未知 | ||
27 | private Integer gender; | 28 | private Integer gender; |
28 | 29 | ||
29 | // 生日 | 30 | /** 生日 */ |
30 | private String birthday; | 31 | private String birthday; |
31 | 32 | ||
32 | // 生日字符串 | 33 | /** 电话 */ |
33 | private String birthdayStr; | 34 | private String phone; |
34 | |||
35 | // vip | ||
36 | private Integer vip; | ||
37 | 35 | ||
38 | // 星座 | 36 | /** 星座 */ |
39 | private String constellation; | 37 | private String constellation; |
40 | 38 | ||
41 | private Long vipExpireTime; | 39 | /** 身份证 */ |
42 | |||
43 | private String phone; | ||
44 | |||
45 | // 身份证 | ||
46 | private String idCard; | 40 | private String idCard; |
47 | 41 | ||
48 | // 电子邮件 | 42 | /** 电子邮件 */ |
49 | private String email; | 43 | private String email; |
50 | 44 | ||
51 | // 国家 | 45 | /** 国家 */ |
52 | private String country; | 46 | private String country; |
53 | 47 | ||
54 | // 省份 | 48 | /** 省份 */ |
55 | private String province; | 49 | private String province; |
56 | 50 | ||
57 | // 城市 | 51 | /** 城市 */ |
58 | private String city; | 52 | private String city; |
59 | 53 | ||
60 | // 头像 | 54 | /** 区县 */ |
61 | private String avatarUrl; | ||
62 | |||
63 | // 区县 | ||
64 | private String district; | 55 | private String district; |
65 | 56 | ||
66 | // 描述 | 57 | /** 描述 */ |
67 | private String description; | 58 | private String description; |
68 | 59 | ||
69 | // 创建时间 | 60 | /** 创建时间 */ |
70 | private Timestamp createTime; | 61 | private Timestamp createTime; |
71 | 62 | ||
72 | // 更新时间 | 63 | /** 更新时间 */ |
73 | private Timestamp updateTime; | 64 | private Timestamp updateTime; |
65 | |||
66 | /** vip */ | ||
67 | private Integer vip; | ||
68 | |||
69 | /** vip过期时间 */ | ||
70 | private Long vipExpireTime; | ||
71 | |||
72 | /** 头像 */ | ||
73 | private String avatarUrl; | ||
74 | } | 74 | } | ... | ... |
This diff is collapsed.
Click to expand it.
1 | package com.topdraw.business.module.member.relatedinfo.domain; | 1 | package com.topdraw.business.module.member.relatedinfo.domain; |
2 | 2 | ||
3 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
4 | import com.topdraw.business.module.common.domain.AsyncMqModule; | ||
3 | import lombok.Data; | 5 | import lombok.Data; |
4 | import lombok.experimental.Accessors; | 6 | import lombok.experimental.Accessors; |
5 | import cn.hutool.core.bean.BeanUtil; | 7 | import cn.hutool.core.bean.BeanUtil; |
... | @@ -13,7 +15,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ... | @@ -13,7 +15,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
13 | import java.sql.Timestamp; | 15 | import java.sql.Timestamp; |
14 | 16 | ||
15 | import java.io.Serializable; | 17 | import java.io.Serializable; |
16 | import java.time.LocalDate; | ||
17 | 18 | ||
18 | /** | 19 | /** |
19 | * @author XiangHan | 20 | * @author XiangHan |
... | @@ -24,56 +25,53 @@ import java.time.LocalDate; | ... | @@ -24,56 +25,53 @@ import java.time.LocalDate; |
24 | @EntityListeners(AuditingEntityListener.class) | 25 | @EntityListeners(AuditingEntityListener.class) |
25 | @Accessors(chain = true) | 26 | @Accessors(chain = true) |
26 | @Table(name="uc_member_related_info") | 27 | @Table(name="uc_member_related_info") |
27 | public class MemberRelatedInfo implements Serializable { | 28 | public class MemberRelatedInfo extends AsyncMqModule implements Serializable { |
28 | 29 | ||
29 | // ID | 30 | /** ID */ |
30 | @Id | 31 | @Id |
31 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 32 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
32 | @Column(name = "id") | 33 | @Column(name = "id") |
33 | @NotNull(groups = {UpdateGroup.class}) | 34 | @NotNull(message = "id can't be null" , groups = {UpdateGroup.class}) |
34 | private Long id; | 35 | private Long id; |
35 | 36 | ||
36 | // 会员id | 37 | /** 会员id */ |
37 | @Column(name = "member_id", nullable = false) | 38 | @Column(name = "member_id", nullable = false) |
38 | private Long memberId; | 39 | private Long memberId; |
39 | 40 | ||
40 | @Transient | 41 | /** 人物关系 0:子女;1:父母 */ |
41 | private String memberCode; | ||
42 | |||
43 | // 人物关系 0:子女;1:父母 | ||
44 | @Column(name = "type") | 42 | @Column(name = "type") |
45 | private Integer type; | 43 | private Integer type; |
46 | 44 | ||
47 | // 手机号 | 45 | /** 手机号 */ |
48 | @Column(name = "cellphone") | 46 | @Column(name = "cellphone") |
49 | private String cellphone; | 47 | private String cellphone; |
50 | 48 | ||
51 | // 身份证号 | 49 | /** 身份证号 */ |
52 | @Column(name = "id_card") | 50 | @Column(name = "id_card") |
53 | private String idCard; | 51 | private String idCard; |
54 | 52 | ||
55 | // 姓名 | 53 | /** 姓名 */ |
56 | @Column(name = "name") | 54 | @Column(name = "name") |
57 | private String name; | 55 | private String name; |
58 | 56 | ||
59 | // 性别 0:女;1:男;-1:未知 | 57 | /** 性别 0:女;1:男;-1:未知 */ |
60 | @Column(name = "sex") | 58 | @Column(name = "sex") |
61 | private Integer sex; | 59 | private Integer sex; |
62 | 60 | ||
63 | // 生日 | 61 | /** 生日 */ |
64 | @Column(name = "birthday") | 62 | @Column(name = "birthday") |
65 | private LocalDate birthday; | 63 | private String birthday; |
66 | 64 | ||
67 | // 头像地址 | 65 | /** 头像地址 */ |
68 | @Column(name = "avatar_url") | 66 | @Column(name = "avatar_url") |
69 | private String avatarUrl; | 67 | private String avatarUrl; |
70 | 68 | ||
71 | // 创建时间 | 69 | /** 创建时间 */ |
72 | @CreatedDate | 70 | @CreatedDate |
73 | @Column(name = "create_time") | 71 | @Column(name = "create_time") |
74 | private Timestamp createTime; | 72 | private Timestamp createTime; |
75 | 73 | ||
76 | // 更新时间 | 74 | /** 更新时间 */ |
77 | @LastModifiedDate | 75 | @LastModifiedDate |
78 | @Column(name = "update_time") | 76 | @Column(name = "update_time") |
79 | private Timestamp updateTime; | 77 | private Timestamp updateTime; | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/module/member/service/dto/BasicMemberDTO.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/module/points/detail/domain/PointsDetail.java
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/module/task/domain/TaskBuilder.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/module/task/rest/TaskController.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/module/task/service/impl/TaskServiceImpl.java
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/module/task/template/domain/TaskTemplate.java
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/domain/UserTvBuilder.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/BindGroup.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/TvUnBindBean.java
0 → 100644
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/UnbindGroup.java
0 → 100644
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/UserOperationBean.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/WeixinUnBindBean.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/business/process/service/dto/MemberAndUserTvDTO.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/weixin/applet/WeiXinAppletUserParser.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/weixin/beans/DefaultWeiXinBeanDefinition.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/weixin/beans/WeiXinBeanDefinition.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/weixin/beans/config/WeiXinAppListConfig.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/main/java/com/topdraw/weixin/subscribe/domain/WechatSubscribeRecord.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
member-service-impl/src/test/java/com/topdraw/test/business/basicdata/coupon/CouponServiceTest.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment