UserOperationServiceImpl.java
2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.topdraw.business.process.service.impl;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.service.UserTvService;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.UserWeixinService;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.process.service.UserOperationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Service
@Slf4j
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class UserOperationServiceImpl implements UserOperationService {
@Autowired
private MemberService memberService;
@Autowired
private UserTvService userTvService;
@Autowired
private UserWeixinService userWeixinService;
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public void asyncWeixinMemberAndUserWeixin4Iptv(MemberDTO memberDTO, UserWeixinDTO weixinDTO) {
this.saveMember(memberDTO);
this.saveWeixin(weixinDTO);
}
private void saveMember(MemberDTO memberDTO){
Member member = new Member();
BeanUtils.copyProperties(memberDTO, member);
this.memberService.create(member);
}
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public void asyncMemberAndUserTv4Iptv(MemberDTO memberDTO, UserTvDTO userTvDTO) {
this.saveMember(memberDTO);
this.saveUserTv(userTvDTO);
}
public void asyncWeixin(UserWeixinDTO weixinDTO) {
this.saveWeixin(weixinDTO);
}
private void saveWeixin(UserWeixinDTO weixinDTO){
UserWeixin userWeixin = new UserWeixin();
BeanUtils.copyProperties(weixinDTO, userWeixin);
this.userWeixinService.create(userWeixin);
}
public void asyncUserTv(UserTvDTO userTvDTO) {
this.saveUserTv(userTvDTO);
}
private void saveUserTv(UserTvDTO userTvDTO){
UserTv userTv = new UserTv();
BeanUtils.copyProperties(userTvDTO, userTv);
this.userTvService.create(userTv);
}
public void asyncMember(MemberDTO memberDTO) {
this.saveMember(memberDTO);
}
}