1.优化
Showing
16 changed files
with
138 additions
and
147 deletions
... | @@ -55,8 +55,8 @@ public class MemberAddressBuilder { | ... | @@ -55,8 +55,8 @@ public class MemberAddressBuilder { |
55 | String district = memberAddress.getDistrict(); | 55 | String district = memberAddress.getDistrict(); |
56 | String address = memberAddress.getAddress(); | 56 | String address = memberAddress.getAddress(); |
57 | String zipCode = memberAddress.getZipCode(); | 57 | String zipCode = memberAddress.getZipCode(); |
58 | return build(id,memberId,memberCode,type,isDefault,sequence,status, | 58 | return build(id, memberId, memberCode, type, isDefault, sequence, status, |
59 | contactor,cellphone,country,province,city,district,address,zipCode); | 59 | contactor, cellphone, country, province, city, district, address, zipCode); |
60 | } | 60 | } |
61 | 61 | ||
62 | public static MemberAddress build(MemberAddress memberAddress){ | 62 | public static MemberAddress build(MemberAddress memberAddress){ |
... | @@ -75,27 +75,27 @@ public class MemberAddressBuilder { | ... | @@ -75,27 +75,27 @@ public class MemberAddressBuilder { |
75 | String district = memberAddress.getDistrict(); | 75 | String district = memberAddress.getDistrict(); |
76 | String address = memberAddress.getAddress(); | 76 | String address = memberAddress.getAddress(); |
77 | String zipCode = memberAddress.getZipCode(); | 77 | String zipCode = memberAddress.getZipCode(); |
78 | return build(id,memberId,memberCode,type,isDefault,sequence,status, | 78 | return build(id, memberId, memberCode, type, isDefault, sequence, status, |
79 | contactor,cellphone,country,province,city,district,address,zipCode); | 79 | contactor, cellphone, country, province, city, district, address, zipCode); |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | public static MemberAddress build(Long id , Long memberId,String memberCode, | 83 | public static MemberAddress build(Long id , Long memberId,String memberCode, |
84 | Integer sequence,Integer type ,Integer isDefault , Integer status, | 84 | Integer type ,Integer isDefault, Integer sequence, Integer status, |
85 | String contactor,String cellphone, | 85 | String contactor, String cellphone, |
86 | String country,String province,String city, | 86 | String country, String province, String city, |
87 | String district,String address,String zipCode){ | 87 | String district, String address, String zipCode){ |
88 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | 88 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); |
89 | 89 | ||
90 | MemberAddress memberAddress = new MemberAddress(); | 90 | MemberAddress memberAddress = new MemberAddress(); |
91 | memberAddress.setId(Objects.nonNull(id)?null:id); | 91 | memberAddress.setId(Objects.isNull(id)?null:id); |
92 | memberAddress.setMemberId(Objects.isNull(memberId)?null:memberId); | 92 | memberAddress.setMemberId(Objects.isNull(memberId)?null:memberId); |
93 | memberAddress.setMemberCode(stringIsNull(memberCode)); | 93 | memberAddress.setMemberCode(stringIsNull(memberCode)); |
94 | 94 | ||
95 | memberAddress.setSequence(Objects.nonNull(sequence)?null:DEFAULT_VALUE_1); | 95 | memberAddress.setSequence(Objects.isNull(sequence)?DEFAULT_VALUE_1:sequence); |
96 | memberAddress.setType(Objects.isNull(type)?null:DEFAULT_VALUE_0); | 96 | memberAddress.setType(Objects.isNull(type)?DEFAULT_VALUE_0:type); |
97 | memberAddress.setIsDefault(Objects.nonNull(isDefault)?null:DEFAULT_VALUE_0); | 97 | memberAddress.setIsDefault(Objects.isNull(isDefault)?DEFAULT_VALUE_0:isDefault); |
98 | memberAddress.setStatus(Objects.isNull(status)?null:DEFAULT_VALUE_1); | 98 | memberAddress.setStatus(Objects.isNull(status)?DEFAULT_VALUE_1:status); |
99 | 99 | ||
100 | memberAddress.setContactor(stringIsNull(contactor)); | 100 | memberAddress.setContactor(stringIsNull(contactor)); |
101 | memberAddress.setCellphone(stringIsNull(cellphone)); | 101 | memberAddress.setCellphone(stringIsNull(cellphone)); | ... | ... |
... | @@ -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 | } | ... | ... |
... | @@ -54,7 +54,7 @@ public class MemberAddressController { | ... | @@ -54,7 +54,7 @@ public class MemberAddressController { |
54 | @RequestMapping(value = "/delete/{id}") | 54 | @RequestMapping(value = "/delete/{id}") |
55 | @ApiOperation("删除会员地址") | 55 | @ApiOperation("删除会员地址") |
56 | @AnonymousAccess | 56 | @AnonymousAccess |
57 | public ResultInfo delete(@PathVariable Long resources) { | 57 | public ResultInfo delete(@PathVariable(value = "id") Long resources) { |
58 | log.info("memberAddress ==>> delete ==> param ==>> [{}]",resources); | 58 | log.info("memberAddress ==>> delete ==> param ==>> [{}]",resources); |
59 | this.memberAddressOperationService.delete(resources); | 59 | this.memberAddressOperationService.delete(resources); |
60 | return ResultInfo.success(); | 60 | return ResultInfo.success(); | ... | ... |
... | @@ -33,4 +33,11 @@ public interface MemberAddressService { | ... | @@ -33,4 +33,11 @@ public interface MemberAddressService { |
33 | * @param resources | 33 | * @param resources |
34 | */ | 34 | */ |
35 | void delete(Long resources); | 35 | void delete(Long resources); |
36 | |||
37 | /** | ||
38 | * 地址最大序列号 | ||
39 | * @param memberId | ||
40 | * @return | ||
41 | */ | ||
42 | int findMaxSequenceByMemberId(Long memberId); | ||
36 | } | 43 | } | ... | ... |
... | @@ -12,6 +12,9 @@ import java.time.LocalDateTime; | ... | @@ -12,6 +12,9 @@ import java.time.LocalDateTime; |
12 | @Data | 12 | @Data |
13 | public class MemberAddressDTO implements Serializable { | 13 | public class MemberAddressDTO implements Serializable { |
14 | 14 | ||
15 | /** 会员code */ | ||
16 | private String memberCode; | ||
17 | |||
15 | /** 主键 */ | 18 | /** 主键 */ |
16 | private Long id; | 19 | private Long id; |
17 | 20 | ... | ... |
... | @@ -51,6 +51,7 @@ public class MemberAddressServiceImpl implements MemberAddressService { | ... | @@ -51,6 +51,7 @@ public class MemberAddressServiceImpl implements MemberAddressService { |
51 | public MemberAddressDTO create(MemberAddress resources) { | 51 | public MemberAddressDTO create(MemberAddress resources) { |
52 | log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources); | 52 | log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources); |
53 | MemberDTO memberDTO = this.checkMember(resources); | 53 | MemberDTO memberDTO = this.checkMember(resources); |
54 | |||
54 | MemberAddress _memberAddress = MemberAddressBuilder.build(resources, memberDTO.getId(), memberDTO.getCode()); | 55 | MemberAddress _memberAddress = MemberAddressBuilder.build(resources, memberDTO.getId(), memberDTO.getCode()); |
55 | MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress); | 56 | MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress); |
56 | 57 | ||
... | @@ -96,6 +97,11 @@ public class MemberAddressServiceImpl implements MemberAddressService { | ... | @@ -96,6 +97,11 @@ public class MemberAddressServiceImpl implements MemberAddressService { |
96 | this.memberAddressRepository.delete(MemberAddress); | 97 | this.memberAddressRepository.delete(MemberAddress); |
97 | } | 98 | } |
98 | 99 | ||
100 | @Override | ||
101 | public int findMaxSequenceByMemberId(Long memberId) { | ||
102 | return this.memberAddressRepository.findMaxSequenceByMemberId(memberId); | ||
103 | } | ||
104 | |||
99 | /** | 105 | /** |
100 | * 检查会员 | 106 | * 检查会员 |
101 | * @param memberAddress | 107 | * @param memberAddress | ... | ... |
... | @@ -42,8 +42,9 @@ public class MemberProfileController { | ... | @@ -42,8 +42,9 @@ public class MemberProfileController { |
42 | return ResultInfo.success(memberProfileDTO); | 42 | return ResultInfo.success(memberProfileDTO); |
43 | } | 43 | } |
44 | 44 | ||
45 | @PutMapping | 45 | @Log("修改会员属性并同步会员信息") |
46 | @ApiOperation("修改MemberProfile") | 46 | @PutMapping(value = "/updateMemberProfileAndMember") |
47 | @ApiOperation("修改会员属性并同步会员信息") | ||
47 | @AnonymousAccess | 48 | @AnonymousAccess |
48 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { | 49 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { |
49 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | 50 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | ... | ... |
... | @@ -12,6 +12,9 @@ import java.io.Serializable; | ... | @@ -12,6 +12,9 @@ import java.io.Serializable; |
12 | @Data | 12 | @Data |
13 | public class MemberProfileDTO implements Serializable { | 13 | public class MemberProfileDTO implements Serializable { |
14 | 14 | ||
15 | /** 会员code */ | ||
16 | private String memberCode; | ||
17 | |||
15 | /** 主键 */ | 18 | /** 主键 */ |
16 | private Long id; | 19 | private Long id; |
17 | 20 | ... | ... |
... | @@ -107,10 +107,10 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -107,10 +107,10 @@ public class MemberServiceImpl implements MemberService { |
107 | public MemberDTO create(Member resources) { | 107 | public MemberDTO create(Member resources) { |
108 | 108 | ||
109 | Member member = MemberBuilder.build(resources); | 109 | Member member = MemberBuilder.build(resources); |
110 | Long memberId = this.save(member); | 110 | Member _member = this.save(member); |
111 | 111 | ||
112 | if (Objects.nonNull(memberId)) { | 112 | if (Objects.nonNull(_member.getId())) { |
113 | MemberProfile memberProfile = MemberProfileBuilder.build(member); | 113 | MemberProfile memberProfile = MemberProfileBuilder.build(_member); |
114 | // 保存会员属性 | 114 | // 保存会员属性 |
115 | this.memberProfileService.create(memberProfile); | 115 | this.memberProfileService.create(memberProfile); |
116 | } | 116 | } |
... | @@ -142,9 +142,9 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -142,9 +142,9 @@ public class MemberServiceImpl implements MemberService { |
142 | BeanUtils.copyProperties(memberDTO,member); | 142 | BeanUtils.copyProperties(memberDTO,member); |
143 | member.copy(resources); | 143 | member.copy(resources); |
144 | 144 | ||
145 | this.save(member); | 145 | Member _member = this.save(member); |
146 | 146 | ||
147 | return this.memberMapper.toDto(member); | 147 | return this.memberMapper.toDto(_member); |
148 | 148 | ||
149 | } catch (Exception e) { | 149 | } catch (Exception e) { |
150 | e.printStackTrace(); | 150 | e.printStackTrace(); |
... | @@ -156,9 +156,8 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -156,9 +156,8 @@ public class MemberServiceImpl implements MemberService { |
156 | } | 156 | } |
157 | 157 | ||
158 | @Transactional(propagation = Propagation.REQUIRES_NEW) | 158 | @Transactional(propagation = Propagation.REQUIRES_NEW) |
159 | public Long save(Member member){ | 159 | public Member save(Member member){ |
160 | this.memberRepository.save(member); | 160 | return this.memberRepository.save(member); |
161 | return member.getId(); | ||
162 | } | 161 | } |
163 | 162 | ||
164 | @Override | 163 | @Override |
... | @@ -171,9 +170,9 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -171,9 +170,9 @@ public class MemberServiceImpl implements MemberService { |
171 | ValidationUtil.isNull(member.getId(), "Member", "id", resources.getId()); | 170 | ValidationUtil.isNull(member.getId(), "Member", "id", resources.getId()); |
172 | member.copy(resources); | 171 | member.copy(resources); |
173 | 172 | ||
174 | this.save(member); | 173 | Member _member = this.save(member); |
175 | 174 | ||
176 | return this.memberMapper.toDto(member); | 175 | return this.memberMapper.toDto(_member); |
177 | 176 | ||
178 | } catch (Exception e) { | 177 | } catch (Exception e) { |
179 | e.printStackTrace(); | 178 | e.printStackTrace(); | ... | ... |
1 | package com.topdraw.business.process.service.dto; | ||
2 | |||
3 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ||
4 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
5 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | ||
6 | import lombok.AllArgsConstructor; | ||
7 | import lombok.Data; | ||
8 | import lombok.NoArgsConstructor; | ||
9 | |||
10 | import java.io.Serializable; | ||
11 | |||
12 | /** | ||
13 | * @author : | ||
14 | * @description: | ||
15 | * @function : | ||
16 | * @date :Created in 2022/3/23 9:48 | ||
17 | * @version: : | ||
18 | * @modified By: | ||
19 | * @since : modified in 2022/3/23 9:48 | ||
20 | */ | ||
21 | |||
22 | @Data | ||
23 | @AllArgsConstructor | ||
24 | @NoArgsConstructor | ||
25 | public class MemberProfileAndMemberDTO implements Serializable { | ||
26 | |||
27 | private MemberProfileDTO memberProfileDTO; | ||
28 | private MemberDTO memberDTO; | ||
29 | } |
... | @@ -102,13 +102,9 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -102,13 +102,9 @@ public class UserOperationServiceImpl implements UserOperationService { |
102 | 102 | ||
103 | 103 | ||
104 | @AsyncMqSend | 104 | @AsyncMqSend |
105 | public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) { | 105 | public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) {} |
106 | messageProducer.sendMessage(JSON.toJSONString(memberAndWeixinUserDTO)); | ||
107 | } | ||
108 | @AsyncMqSend | 106 | @AsyncMqSend |
109 | public void asyncMemberAndUserTv4Iptv(MemberAndUserTvDTO memberAndUserTv) { | 107 | public void asyncMemberAndUserTv4Iptv(MemberAndUserTvDTO memberAndUserTv) {} |
110 | //messageProducer.sendMessage(JSON.toJSONString(memberAndUserTv)); | ||
111 | } | ||
112 | @AsyncMqSend | 108 | @AsyncMqSend |
113 | public void asyncWeixin(UserWeixinDTO weixinDTO) { | 109 | public void asyncWeixin(UserWeixinDTO weixinDTO) { |
114 | messageProducer.sendMessage(JSON.toJSONString(weixinDTO)); | 110 | messageProducer.sendMessage(JSON.toJSONString(weixinDTO)); |
... | @@ -203,7 +199,7 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -203,7 +199,7 @@ public class UserOperationServiceImpl implements UserOperationService { |
203 | UserWeixinDTO weixinDTO = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode()); | 199 | UserWeixinDTO weixinDTO = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode()); |
204 | 200 | ||
205 | // 同步至iptv | 201 | // 同步至iptv |
206 | this.asyncWeixin(weixinDTO); | 202 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncWeixin(weixinDTO); |
207 | 203 | ||
208 | return weixinDTO; | 204 | return weixinDTO; |
209 | } | 205 | } |
... | @@ -223,7 +219,7 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -223,7 +219,7 @@ public class UserOperationServiceImpl implements UserOperationService { |
223 | UserWeixinDTO _userWeixinDTO1 = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode()); | 219 | UserWeixinDTO _userWeixinDTO1 = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode()); |
224 | 220 | ||
225 | // 同步至iptv | 221 | // 同步至iptv |
226 | this.asyncMemberAndUserWeixin4Iptv(new MemberAndWeixinUserDTO(memberDTO, _userWeixinDTO1)); | 222 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncMemberAndUserWeixin4Iptv(new MemberAndWeixinUserDTO(memberDTO, _userWeixinDTO1)); |
227 | 223 | ||
228 | return _userWeixinDTO1; | 224 | return _userWeixinDTO1; |
229 | } | 225 | } | ... | ... |
... | @@ -4,8 +4,13 @@ import com.topdraw.aspect.AsyncMqSend; | ... | @@ -4,8 +4,13 @@ import com.topdraw.aspect.AsyncMqSend; |
4 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 4 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
5 | import com.topdraw.business.module.member.address.service.MemberAddressService; | 5 | import com.topdraw.business.module.member.address.service.MemberAddressService; |
6 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | 6 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
7 | import com.topdraw.business.module.member.service.MemberService; | ||
8 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
7 | import com.topdraw.business.process.service.member.MemberAddressOperationService; | 9 | import com.topdraw.business.process.service.member.MemberAddressOperationService; |
10 | import com.topdraw.exception.BadRequestException; | ||
11 | import com.topdraw.exception.GlobeExceptionMsg; | ||
8 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
13 | import org.springframework.aop.framework.AopContext; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
10 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
11 | import org.springframework.transaction.annotation.Propagation; | 16 | import org.springframework.transaction.annotation.Propagation; |
... | @@ -22,6 +27,13 @@ public class MemberAddressOperationServiceImpl implements MemberAddressOperation | ... | @@ -22,6 +27,13 @@ public class MemberAddressOperationServiceImpl implements MemberAddressOperation |
22 | 27 | ||
23 | @Autowired | 28 | @Autowired |
24 | private MemberAddressService memberAddressService; | 29 | private MemberAddressService memberAddressService; |
30 | @Autowired | ||
31 | private MemberService memberService; | ||
32 | |||
33 | @AsyncMqSend | ||
34 | public void asyncMemberAddress(MemberAddressDTO memberAddressDTO){} | ||
35 | @AsyncMqSend | ||
36 | public void asyncDeleteMemberAddress(MemberAddressDTO memberAddressDTO){} | ||
25 | 37 | ||
26 | @Override | 38 | @Override |
27 | public MemberAddressDTO findById(Long id) { | 39 | public MemberAddressDTO findById(Long id) { |
... | @@ -30,25 +42,39 @@ public class MemberAddressOperationServiceImpl implements MemberAddressOperation | ... | @@ -30,25 +42,39 @@ public class MemberAddressOperationServiceImpl implements MemberAddressOperation |
30 | 42 | ||
31 | @Override | 43 | @Override |
32 | @Transactional(rollbackFor = Exception.class) | 44 | @Transactional(rollbackFor = Exception.class) |
33 | @AsyncMqSend | ||
34 | public MemberAddressDTO create(MemberAddress resources) { | 45 | public MemberAddressDTO create(MemberAddress resources) { |
35 | log.info("MemberAddressOperationServiceImpl ==>> create ==>> param ==>> [{}]",resources); | 46 | log.info("MemberAddressOperationServiceImpl ==>> create ==>> param ==>> [{}]",resources); |
36 | return this.memberAddressService.create(resources); | 47 | int maxSequence = this.memberAddressService.findMaxSequenceByMemberId(resources.getMemberId()); |
48 | if (maxSequence < 6) { | ||
49 | resources.setSequence(maxSequence+1); | ||
50 | MemberAddressDTO memberAddressDTO = this.memberAddressService.create(resources); | ||
51 | memberAddressDTO.setMemberCode(resources.getMemberCode()); | ||
52 | ((MemberAddressOperationServiceImpl) AopContext.currentProxy()).asyncMemberAddress(memberAddressDTO); | ||
53 | return memberAddressDTO; | ||
54 | } | ||
55 | |||
56 | throw new BadRequestException(GlobeExceptionMsg.SEQUENCE_MAX); | ||
57 | |||
37 | } | 58 | } |
38 | 59 | ||
39 | @Override | 60 | @Override |
40 | @Transactional(rollbackFor = Exception.class) | 61 | @Transactional(rollbackFor = Exception.class) |
41 | @AsyncMqSend | ||
42 | public MemberAddressDTO update(MemberAddress resources) { | 62 | public MemberAddressDTO update(MemberAddress resources) { |
43 | log.info("MemberAddressOperationServiceImpl ==>> update ==>> param ==>> [{}]",resources); | 63 | log.info("MemberAddressOperationServiceImpl ==>> update ==>> param ==>> [{}]",resources); |
44 | return this.memberAddressService.update(resources); | 64 | MemberAddressDTO memberAddressDTO = this.memberAddressService.update(resources); |
65 | memberAddressDTO.setMemberCode(resources.getMemberCode()); | ||
66 | ((MemberAddressOperationServiceImpl) AopContext.currentProxy()).asyncMemberAddress(memberAddressDTO); | ||
67 | return memberAddressDTO; | ||
45 | } | 68 | } |
46 | 69 | ||
47 | @Override | 70 | @Override |
48 | @Transactional(rollbackFor = Exception.class) | 71 | @Transactional(rollbackFor = Exception.class) |
49 | @AsyncMqSend | ||
50 | public void delete(Long id) { | 72 | public void delete(Long id) { |
73 | MemberAddressDTO memberAddressDTO = this.memberAddressService.findById(id); | ||
74 | MemberDTO memberDTO = this.memberService.findById(memberAddressDTO.getMemberId()); | ||
75 | memberAddressDTO.setMemberCode(memberDTO.getCode()); | ||
51 | this.memberAddressService.delete(id); | 76 | this.memberAddressService.delete(id); |
77 | ((MemberAddressOperationServiceImpl) AopContext.currentProxy()).asyncDeleteMemberAddress(memberAddressDTO); | ||
52 | } | 78 | } |
53 | 79 | ||
54 | } | 80 | } | ... | ... |
... | @@ -37,7 +37,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -37,7 +37,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
37 | @Autowired | 37 | @Autowired |
38 | private MemberService memberService; | 38 | private MemberService memberService; |
39 | @Autowired | 39 | @Autowired |
40 | private MemberProfileOperationService memberProfileOperationService; | 40 | private MemberProfileService memberProfileService; |
41 | @Autowired | 41 | @Autowired |
42 | private MemberVipHistoryService memberVipHistoryService; | 42 | private MemberVipHistoryService memberVipHistoryService; |
43 | @Autowired | 43 | @Autowired |
... | @@ -278,6 +278,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -278,6 +278,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
278 | * @return | 278 | * @return |
279 | */ | 279 | */ |
280 | private MemberProfileDTO findMemberProfileByMemberId(Long memberId) { | 280 | private MemberProfileDTO findMemberProfileByMemberId(Long memberId) { |
281 | return this.memberProfileOperationService.findByMemberId(memberId); | 281 | return this.memberProfileService.findByMemberId(memberId); |
282 | } | 282 | } |
283 | } | 283 | } | ... | ... |
1 | package com.topdraw.business.process.service.impl.member; | 1 | package com.topdraw.business.process.service.impl.member; |
2 | 2 | ||
3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
4 | import com.topdraw.business.module.member.domain.Member; | ||
5 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
6 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 5 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
7 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
7 | import com.topdraw.business.module.member.service.MemberService; | ||
8 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
9 | import com.topdraw.business.process.service.member.MemberOperationService; | 9 | import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO; |
10 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | 10 | import com.topdraw.business.process.service.member.MemberProfileOperationService; |
11 | import org.apache.commons.lang3.StringUtils; | ||
12 | import org.springframework.aop.framework.AopContext; | ||
11 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
13 | import org.springframework.util.StringUtils; | ||
14 | 15 | ||
15 | import javax.validation.constraints.NotNull; | ||
16 | 16 | ||
17 | /** | 17 | /** |
18 | * @author : | 18 | * @author : |
... | @@ -29,65 +29,36 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation | ... | @@ -29,65 +29,36 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation |
29 | @Autowired | 29 | @Autowired |
30 | private MemberProfileService memberProfileService; | 30 | private MemberProfileService memberProfileService; |
31 | @Autowired | 31 | @Autowired |
32 | private MemberOperationService memberOperationService; | 32 | private MemberService memberService; |
33 | 33 | ||
34 | @Override | ||
35 | public MemberProfileDTO findById(Long id) { | ||
36 | return this.memberProfileService.findById(id); | ||
37 | } | ||
38 | |||
39 | @Override | ||
40 | @AsyncMqSend | 34 | @AsyncMqSend |
41 | public MemberProfile create(MemberProfile resources) { | 35 | public void asyncMemberProfile(MemberProfileDTO memberProfileDTO){} |
42 | return this.memberProfileService.create(resources); | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | public MemberProfile createDefault(MemberProfile resources) { | ||
47 | return this.memberProfileService.createDefault(resources); | ||
48 | } | ||
49 | |||
50 | @Override | ||
51 | public MemberProfile createDefault(Member resources) { | ||
52 | return this.memberProfileService.createDefault(resources); | ||
53 | } | ||
54 | |||
55 | @Override | ||
56 | public MemberProfile createDefaultByMemberId(Long resources) { | ||
57 | return this.memberProfileService.createDefaultByMemberId(resources); | ||
58 | } | ||
59 | |||
60 | @Override | ||
61 | @AsyncMqSend | 36 | @AsyncMqSend |
62 | public MemberProfileDTO update(MemberProfile resources) { | 37 | public void asyncMemberProfileAndMember(MemberProfileAndMemberDTO memberProfileAndMemberDTO){} |
63 | return this.memberProfileService.update(resources); | ||
64 | } | ||
65 | |||
66 | @Override | ||
67 | public void delete(Long id) { | ||
68 | this.memberProfileService.delete(id); | ||
69 | } | ||
70 | 38 | ||
71 | @Override | 39 | @Override |
72 | public MemberProfileDTO findByMemberId(Long memberId) { | 40 | public MemberProfileDTO update(MemberProfile resources) { |
73 | return this.memberProfileService.findByMemberId(memberId); | 41 | MemberProfileDTO memberProfileDTO = this.memberProfileService.update(resources); |
74 | } | 42 | memberProfileDTO.setMemberCode(resources.getMemberCode()); |
75 | 43 | ((MemberProfileOperationServiceImpl) AopContext.currentProxy()).asyncMemberProfile(memberProfileDTO); | |
76 | @Override | 44 | return memberProfileDTO; |
77 | public MemberProfileDTO findByMemberCode(String memberCode) { | ||
78 | return this.memberProfileService.findByMemberCode(memberCode); | ||
79 | } | 45 | } |
80 | 46 | ||
81 | @Override | 47 | @Override |
82 | @AsyncMqSend | ||
83 | public MemberProfileDTO updateMemberProfileAndMember(MemberProfile resources) { | 48 | public MemberProfileDTO updateMemberProfileAndMember(MemberProfile resources) { |
84 | String memberCode = resources.getMemberCode(); | 49 | String memberCode = resources.getMemberCode(); |
85 | MemberDTO memberDTO = null; | 50 | MemberDTO memberDTO = null; |
86 | if (StringUtils.isEmpty(memberCode)) { | 51 | if (StringUtils.isNotBlank(memberCode)) { |
87 | memberDTO = this.memberOperationService.findByCode(memberCode); | 52 | memberDTO = this.memberService.findByCode(memberCode); |
88 | resources.setMemberCode(memberDTO.getCode()); | 53 | resources.setMemberCode(memberDTO.getCode()); |
89 | } | 54 | } |
90 | 55 | ||
91 | return this.memberProfileService.updateMemberProfileAndMember(resources, memberDTO); | 56 | MemberProfileDTO memberProfileDTO = |
57 | this.memberProfileService.updateMemberProfileAndMember(resources, memberDTO); | ||
58 | memberProfileDTO.setMemberCode(memberCode); | ||
59 | ((MemberProfileOperationServiceImpl)AopContext.currentProxy()) | ||
60 | .asyncMemberProfileAndMember(new MemberProfileAndMemberDTO(memberProfileDTO, memberDTO)); | ||
61 | |||
62 | return memberProfileDTO; | ||
92 | } | 63 | } |
93 | } | 64 | } | ... | ... |
... | @@ -7,67 +7,12 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ... | @@ -7,67 +7,12 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
7 | public interface MemberProfileOperationService { | 7 | public interface MemberProfileOperationService { |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * 根据ID查询 | ||
11 | * @param id ID | ||
12 | * @return MemberProfileDTO | ||
13 | */ | ||
14 | MemberProfileDTO findById(Long id); | ||
15 | |||
16 | /** | ||
17 | * 保存 | ||
18 | * @param resources 会员基本信息 | ||
19 | * @return | ||
20 | */ | ||
21 | MemberProfile create(MemberProfile resources); | ||
22 | |||
23 | /** | ||
24 | * 默认属性 | ||
25 | * @param resources | ||
26 | * @return | ||
27 | */ | ||
28 | MemberProfile createDefault(MemberProfile resources); | ||
29 | |||
30 | /** | ||
31 | * 通过会员创建默认属性 | ||
32 | * @param resources | ||
33 | * @return | ||
34 | */ | ||
35 | MemberProfile createDefault(Member resources); | ||
36 | |||
37 | /** | ||
38 | * 通过会员id创建默认属性 | ||
39 | * @param resources | ||
40 | * @return | ||
41 | */ | ||
42 | MemberProfile createDefaultByMemberId(Long resources); | ||
43 | |||
44 | /** | ||
45 | * 修改 | 10 | * 修改 |
46 | * @param resources | 11 | * @param resources |
47 | */ | 12 | */ |
48 | MemberProfileDTO update(MemberProfile resources); | 13 | MemberProfileDTO update(MemberProfile resources); |
49 | 14 | ||
50 | /** | 15 | /** |
51 | * 删除 | ||
52 | * @param id | ||
53 | */ | ||
54 | void delete(Long id); | ||
55 | |||
56 | /** | ||
57 | * 通过会员id查询 | ||
58 | * @param memberId | ||
59 | * @return | ||
60 | */ | ||
61 | MemberProfileDTO findByMemberId(Long memberId); | ||
62 | |||
63 | /** | ||
64 | * 通过会员code查询 | ||
65 | * @param memberCode | ||
66 | * @return | ||
67 | */ | ||
68 | MemberProfileDTO findByMemberCode(String memberCode); | ||
69 | |||
70 | /** | ||
71 | * 修改会员属性并同步会员信息 | 16 | * 修改会员属性并同步会员信息 |
72 | * @param resources | 17 | * @param resources |
73 | */ | 18 | */ | ... | ... |
... | @@ -31,7 +31,7 @@ public interface GlobeExceptionMsg { | ... | @@ -31,7 +31,7 @@ public interface GlobeExceptionMsg { |
31 | String MEMBER_ID_AND_CODE_ARE_NULL = "memberId and memberCode both null"; | 31 | String MEMBER_ID_AND_CODE_ARE_NULL = "memberId and memberCode both null"; |
32 | String MEMBER_INFO_ERROR = "member info is error"; | 32 | String MEMBER_INFO_ERROR = "member info is error"; |
33 | String MEMBER_BLOCK_STATUS = "member status is block"; | 33 | String MEMBER_BLOCK_STATUS = "member status is block"; |
34 | 34 | String SEQUENCE_MAX = "member address more then 5"; | |
35 | /**************************************************************/ | 35 | /**************************************************************/ |
36 | 36 | ||
37 | /** 账户管理 **/ | 37 | /** 账户管理 **/ |
... | @@ -47,4 +47,5 @@ public interface GlobeExceptionMsg { | ... | @@ -47,4 +47,5 @@ public interface GlobeExceptionMsg { |
47 | String OPEN_ID_IS_NULL = "openId is null"; | 47 | String OPEN_ID_IS_NULL = "openId is null"; |
48 | String UNION_ID_IS_NULL = "unionId is null"; | 48 | String UNION_ID_IS_NULL = "unionId is null"; |
49 | String ALREADY_BIND = "already bind"; | 49 | String ALREADY_BIND = "already bind"; |
50 | |||
50 | } | 51 | } | ... | ... |
-
Please register or sign in to post a comment