1.优惠
Showing
10 changed files
with
87 additions
and
9 deletions
... | @@ -26,7 +26,7 @@ public class MemberAddress extends AsyncMqModule implements Serializable { | ... | @@ -26,7 +26,7 @@ public class MemberAddress extends AsyncMqModule implements Serializable { |
26 | 26 | ||
27 | /** 主键 */ | 27 | /** 主键 */ |
28 | @Id | 28 | @Id |
29 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 29 | @GeneratedValue(strategy = GenerationType.SEQUENCE) |
30 | @Column(name = "id") | 30 | @Column(name = "id") |
31 | private Long id; | 31 | private Long id; |
32 | 32 | ... | ... |
... | @@ -35,7 +35,7 @@ public class Member implements Serializable { | ... | @@ -35,7 +35,7 @@ public class Member implements Serializable { |
35 | 35 | ||
36 | /** 主键 */ | 36 | /** 主键 */ |
37 | @Id | 37 | @Id |
38 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 38 | @GeneratedValue(strategy = GenerationType.SEQUENCE) |
39 | @Column(name = "id") | 39 | @Column(name = "id") |
40 | @NotNull(message = "id can't be null!!",groups = {UpdateGroup.class}) | 40 | @NotNull(message = "id can't be null!!",groups = {UpdateGroup.class}) |
41 | private Long id; | 41 | private Long id; | ... | ... |
... | @@ -37,7 +37,7 @@ public class MemberProfile implements Serializable { | ... | @@ -37,7 +37,7 @@ public class MemberProfile implements Serializable { |
37 | 37 | ||
38 | /** 主键 */ | 38 | /** 主键 */ |
39 | @Id | 39 | @Id |
40 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 40 | @GeneratedValue(strategy = GenerationType.SEQUENCE) |
41 | @Column(name = "id") | 41 | @Column(name = "id") |
42 | @NotNull(message = "id not be null!!" , groups = UpdateGroup.class) | 42 | @NotNull(message = "id not be null!!" , groups = UpdateGroup.class) |
43 | private Long id; | 43 | private Long id; | ... | ... |
... | @@ -29,7 +29,7 @@ public class MemberRelatedInfo extends AsyncMqModule implements Serializable { | ... | @@ -29,7 +29,7 @@ public class MemberRelatedInfo extends AsyncMqModule implements Serializable { |
29 | 29 | ||
30 | /** ID */ | 30 | /** ID */ |
31 | @Id | 31 | @Id |
32 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 32 | @GeneratedValue(strategy = GenerationType.SEQUENCE) |
33 | @Column(name = "id") | 33 | @Column(name = "id") |
34 | @NotNull(message = "id can't be null" , groups = {UpdateGroup.class}) | 34 | @NotNull(message = "id can't be null" , groups = {UpdateGroup.class}) |
35 | private Long id; | 35 | private Long id; | ... | ... |
... | @@ -11,7 +11,6 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; | ... | @@ -11,7 +11,6 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; |
11 | import com.topdraw.business.module.member.service.mapper.MemberMapper; | 11 | import com.topdraw.business.module.member.service.mapper.MemberMapper; |
12 | import com.topdraw.exception.BadRequestException; | 12 | import com.topdraw.exception.BadRequestException; |
13 | import com.topdraw.exception.GlobeExceptionMsg; | 13 | import com.topdraw.exception.GlobeExceptionMsg; |
14 | import com.topdraw.utils.RedisUtils; | ||
15 | import com.topdraw.utils.ValidationUtil; | 14 | import com.topdraw.utils.ValidationUtil; |
16 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
17 | import org.apache.commons.lang3.StringUtils; | 16 | import org.apache.commons.lang3.StringUtils; |
... | @@ -146,7 +145,6 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -146,7 +145,6 @@ public class MemberServiceImpl implements MemberService { |
146 | 145 | ||
147 | } | 146 | } |
148 | 147 | ||
149 | @Transactional(propagation = Propagation.REQUIRES_NEW) | ||
150 | public Long save(Member member){ | 148 | public Long save(Member member){ |
151 | this.memberRepository.save(member); | 149 | this.memberRepository.save(member); |
152 | return member.getId(); | 150 | return member.getId(); | ... | ... |
... | @@ -27,7 +27,7 @@ public class MemberVipHistory extends AsyncMqModule implements Serializable { | ... | @@ -27,7 +27,7 @@ public class MemberVipHistory extends AsyncMqModule implements Serializable { |
27 | 27 | ||
28 | // 主键 | 28 | // 主键 |
29 | @Id | 29 | @Id |
30 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 30 | @GeneratedValue(strategy = GenerationType.SEQUENCE) |
31 | @Column(name = "id") | 31 | @Column(name = "id") |
32 | private Long id; | 32 | private Long id; |
33 | 33 | ... | ... |
... | @@ -37,7 +37,7 @@ public class UserTv extends AsyncMqModule implements Serializable { | ... | @@ -37,7 +37,7 @@ public class UserTv extends AsyncMqModule implements Serializable { |
37 | 37 | ||
38 | /** ID */ | 38 | /** ID */ |
39 | @Id | 39 | @Id |
40 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 40 | @GeneratedValue(strategy = GenerationType.SEQUENCE) |
41 | @Column(name = "id") | 41 | @Column(name = "id") |
42 | private Long id; | 42 | private Long id; |
43 | 43 | ... | ... |
... | @@ -29,7 +29,7 @@ public class UserWeixin extends AsyncMqModule implements Serializable { | ... | @@ -29,7 +29,7 @@ public class UserWeixin extends AsyncMqModule implements Serializable { |
29 | 29 | ||
30 | /** ID */ | 30 | /** ID */ |
31 | @Id | 31 | @Id |
32 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 32 | @GeneratedValue(strategy = GenerationType.SEQUENCE) |
33 | @Column(name = "id") | 33 | @Column(name = "id") |
34 | private Long id; | 34 | private Long id; |
35 | 35 | ... | ... |
1 | package com.topdraw.business.process.service.impl; | ||
2 | |||
3 | |||
4 | import com.topdraw.business.module.member.domain.Member; | ||
5 | import com.topdraw.business.module.member.service.MemberService; | ||
6 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
7 | import com.topdraw.business.module.user.iptv.domain.UserTv; | ||
8 | import com.topdraw.business.module.user.iptv.service.UserTvService; | ||
9 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | ||
10 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
11 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | ||
12 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
13 | import com.topdraw.business.process.service.UserOperationService; | ||
14 | import lombok.extern.slf4j.Slf4j; | ||
15 | import org.springframework.beans.BeanUtils; | ||
16 | import org.springframework.beans.factory.annotation.Autowired; | ||
17 | import org.springframework.stereotype.Service; | ||
18 | import org.springframework.transaction.annotation.Propagation; | ||
19 | import org.springframework.transaction.annotation.Transactional; | ||
20 | |||
21 | @Service | ||
22 | @Slf4j | ||
23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
24 | public class UserOperationServiceImpl implements UserOperationService { | ||
25 | |||
26 | @Autowired | ||
27 | private MemberService memberService; | ||
28 | @Autowired | ||
29 | private UserTvService userTvService; | ||
30 | @Autowired | ||
31 | private UserWeixinService userWeixinService; | ||
32 | |||
33 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
34 | public void asyncWeixinMemberAndUserWeixin4Iptv(MemberDTO memberDTO, UserWeixinDTO weixinDTO) { | ||
35 | this.saveMember(memberDTO); | ||
36 | this.saveWeixin(weixinDTO); | ||
37 | } | ||
38 | |||
39 | private void saveMember(MemberDTO memberDTO){ | ||
40 | Member member = new Member(); | ||
41 | BeanUtils.copyProperties(memberDTO, member); | ||
42 | this.memberService.create(member); | ||
43 | } | ||
44 | |||
45 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
46 | public void asyncMemberAndUserTv4Iptv(MemberDTO memberDTO, UserTvDTO userTvDTO) { | ||
47 | this.saveMember(memberDTO); | ||
48 | this.saveUserTv(userTvDTO); | ||
49 | } | ||
50 | |||
51 | public void asyncWeixin(UserWeixinDTO weixinDTO) { | ||
52 | this.saveWeixin(weixinDTO); | ||
53 | } | ||
54 | |||
55 | private void saveWeixin(UserWeixinDTO weixinDTO){ | ||
56 | UserWeixin userWeixin = new UserWeixin(); | ||
57 | BeanUtils.copyProperties(weixinDTO, userWeixin); | ||
58 | this.userWeixinService.create(userWeixin); | ||
59 | } | ||
60 | |||
61 | public void asyncUserTv(UserTvDTO userTvDTO) { | ||
62 | this.saveUserTv(userTvDTO); | ||
63 | } | ||
64 | |||
65 | private void saveUserTv(UserTvDTO userTvDTO){ | ||
66 | UserTv userTv = new UserTv(); | ||
67 | BeanUtils.copyProperties(userTvDTO, userTv); | ||
68 | this.userTvService.create(userTv); | ||
69 | } | ||
70 | |||
71 | public void asyncMember(MemberDTO memberDTO) { | ||
72 | this.saveMember(memberDTO); | ||
73 | } | ||
74 | } |
-
Please register or sign in to post a comment