1.优化
Showing
41 changed files
with
843 additions
and
456 deletions
1 | ALTER TABLE `uc_user_tv` | 1 | ALTER TABLE `uc_user_tv` |
2 | ADD COLUMN `vis_user_id` bigint(20) NULL DEFAULT NULL COMMENT 'vis_user表主键' AFTER `platform_account`; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
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 | ... | ... |
... | @@ -22,7 +22,7 @@ import javax.validation.constraints.NotNull; | ... | @@ -22,7 +22,7 @@ import javax.validation.constraints.NotNull; |
22 | public class AsyncMqModule { | 22 | public class AsyncMqModule { |
23 | 23 | ||
24 | @Transient | 24 | @Transient |
25 | @NotNull(message = "memberCode can't be null" , groups = {CreateGroup.class, UpdateGroup.class}) | 25 | @NotNull(message = "memberCode can't be null" , groups = {UpdateGroup.class}) |
26 | private String memberCode; | 26 | private String memberCode; |
27 | 27 | ||
28 | /** 运营商平台账号 */ | 28 | /** 运营商平台账号 */ | ... | ... |
... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.rest; | ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.rest; |
3 | import com.topdraw.aop.log.Log; | 3 | import com.topdraw.aop.log.Log; |
4 | import com.topdraw.business.module.common.validated.CreateGroup; | 4 | import com.topdraw.business.module.common.validated.CreateGroup; |
5 | import com.topdraw.business.module.common.validated.UpdateGroup; | 5 | import com.topdraw.business.module.common.validated.UpdateGroup; |
6 | import com.topdraw.business.process.service.member.MemberAddressOperationService; | ||
6 | import com.topdraw.common.ResultInfo; | 7 | import com.topdraw.common.ResultInfo; |
7 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 8 | 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.MemberAddressService; |
... | @@ -24,14 +25,14 @@ import io.swagger.annotations.*; | ... | @@ -24,14 +25,14 @@ import io.swagger.annotations.*; |
24 | public class MemberAddressController { | 25 | public class MemberAddressController { |
25 | 26 | ||
26 | @Autowired | 27 | @Autowired |
27 | private MemberAddressService memberAddressService; | 28 | private MemberAddressOperationService memberAddressOperationService; |
28 | 29 | ||
29 | @Log("新增会员地址") | 30 | @Log("新增会员地址") |
30 | @RequestMapping(value = "/create") | 31 | @RequestMapping(value = "/create") |
31 | @ApiOperation("新增会员地址") | 32 | @ApiOperation("新增会员地址") |
32 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberAddress resources) { | 33 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberAddress resources) { |
33 | log.info("memberAddress ==>> create ==> param ==>> [{}]",resources); | 34 | log.info("memberAddress ==>> create ==> param ==>> [{}]",resources); |
34 | this.memberAddressService.create(resources); | 35 | this.memberAddressOperationService.create(resources); |
35 | log.info("memberAddress ==>> create ==> result ==>> [{}]",resources); | 36 | log.info("memberAddress ==>> create ==> result ==>> [{}]",resources); |
36 | return ResultInfo.success(); | 37 | return ResultInfo.success(); |
37 | } | 38 | } |
... | @@ -41,7 +42,7 @@ public class MemberAddressController { | ... | @@ -41,7 +42,7 @@ public class MemberAddressController { |
41 | @ApiOperation("修改会员地址") | 42 | @ApiOperation("修改会员地址") |
42 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberAddress resources) { | 43 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberAddress resources) { |
43 | log.info("memberAddress ==>> update ==> param ==>> [{}]",resources); | 44 | log.info("memberAddress ==>> update ==> param ==>> [{}]",resources); |
44 | this.memberAddressService.update(resources); | 45 | this.memberAddressOperationService.update(resources); |
45 | log.info("memberAddress ==>> update ==> result ==>> [{}]",resources); | 46 | log.info("memberAddress ==>> update ==> result ==>> [{}]",resources); |
46 | return ResultInfo.success(); | 47 | return ResultInfo.success(); |
47 | } | 48 | } |
... | @@ -51,7 +52,7 @@ public class MemberAddressController { | ... | @@ -51,7 +52,7 @@ public class MemberAddressController { |
51 | @ApiOperation("删除会员地址") | 52 | @ApiOperation("删除会员地址") |
52 | public ResultInfo delete(@PathVariable Long resources) { | 53 | public ResultInfo delete(@PathVariable Long resources) { |
53 | log.info("memberAddress ==>> delete ==> param ==>> [{}]",resources); | 54 | log.info("memberAddress ==>> delete ==> param ==>> [{}]",resources); |
54 | this.memberAddressService.delete(resources); | 55 | this.memberAddressOperationService.delete(resources); |
55 | return ResultInfo.success(); | 56 | return ResultInfo.success(); |
56 | } | 57 | } |
57 | 58 | ... | ... |
... | @@ -20,13 +20,13 @@ public interface MemberAddressService { | ... | @@ -20,13 +20,13 @@ public interface MemberAddressService { |
20 | * 保存会员地址 | 20 | * 保存会员地址 |
21 | * @param resources | 21 | * @param resources |
22 | */ | 22 | */ |
23 | void create(MemberAddress resources); | 23 | MemberAddressDTO create(MemberAddress resources); |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * 修改会员地址 | 26 | * 修改会员地址 |
27 | * @param resources | 27 | * @param resources |
28 | */ | 28 | */ |
29 | void update(MemberAddress resources); | 29 | MemberAddressDTO update(MemberAddress resources); |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * 通过id删除 | 32 | * 通过id删除 | ... | ... |
... | @@ -11,6 +11,7 @@ import com.topdraw.business.module.member.address.service.MemberAddressService; | ... | @@ -11,6 +11,7 @@ import com.topdraw.business.module.member.address.service.MemberAddressService; |
11 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | 11 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
12 | 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; | 13 | import lombok.extern.slf4j.Slf4j; |
14 | import org.springframework.beans.BeanUtils; | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
15 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
16 | import org.springframework.transaction.annotation.Propagation; | 17 | import org.springframework.transaction.annotation.Propagation; |
... | @@ -47,36 +48,41 @@ public class MemberAddressServiceImpl implements MemberAddressService { | ... | @@ -47,36 +48,41 @@ public class MemberAddressServiceImpl implements MemberAddressService { |
47 | 48 | ||
48 | @Override | 49 | @Override |
49 | @Transactional(rollbackFor = Exception.class) | 50 | @Transactional(rollbackFor = Exception.class) |
50 | public void create(MemberAddress resources) { | 51 | public MemberAddressDTO create(MemberAddress resources) { |
51 | log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources); | 52 | log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources); |
52 | MemberDTO memberDTO = this.checkMember(resources); | 53 | MemberDTO memberDTO = this.checkMember(resources); |
53 | MemberAddress memberAddress = MemberAddressBuilder.build(resources, memberDTO.getId(), memberDTO.getCode()); | 54 | MemberAddress _memberAddress = MemberAddressBuilder.build(resources, memberDTO.getId(), memberDTO.getCode()); |
54 | this.memberAddressRepository.save(memberAddress); | 55 | MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress); |
56 | |||
55 | log.info("MemberAddressServiceImpl ==>> create ==>> result ==>> [{}]",resources); | 57 | log.info("MemberAddressServiceImpl ==>> create ==>> result ==>> [{}]",resources); |
58 | MemberAddressDTO memberAddressDTO = new MemberAddressDTO(); | ||
59 | BeanUtils.copyProperties(memberAddress, memberAddressDTO); | ||
60 | return memberAddressDTO; | ||
61 | |||
56 | } | 62 | } |
57 | 63 | ||
58 | @Override | 64 | @Override |
59 | @Transactional(rollbackFor = Exception.class) | 65 | @Transactional(rollbackFor = Exception.class) |
60 | public void update(MemberAddress resources) { | 66 | public MemberAddressDTO update(MemberAddress resources) { |
61 | log.info("MemberAddressServiceImpl ==>> update ==>> param ==>> [{}]",resources); | 67 | log.info("MemberAddressServiceImpl ==>> update ==>> param ==>> [{}]",resources); |
62 | Assert.notNull(resources.getId(),"id can't be null"); | 68 | Assert.notNull(resources.getId(),"id can't be null"); |
63 | // RLock rLock = this.redissonClient.getLock("MemberAddress::update::code" + resources.getId()); | ||
64 | try { | 69 | try { |
65 | // RedissonUtil.lock(rLock); | ||
66 | this.redisUtils.doLock("MemberAddress::update::code" + resources.getId()); | 70 | this.redisUtils.doLock("MemberAddress::update::code" + resources.getId()); |
67 | MemberDTO memberDTO = this.checkMember(resources); | 71 | MemberDTO memberDTO = this.checkMember(resources); |
68 | resources.setMemberCode(memberDTO.getCode()); | 72 | resources.setMemberCode(memberDTO.getCode()); |
69 | 73 | ||
70 | MemberAddress MemberAddress = this.memberAddressRepository.findById(resources.getId()).orElseGet(MemberAddress::new); | 74 | MemberAddress _memberAddress = this.memberAddressRepository.findById(resources.getId()).orElseGet(MemberAddress::new); |
71 | ValidationUtil.isNull( MemberAddress.getId(),"MemberAddress","id",resources.getId()); | 75 | ValidationUtil.isNull( _memberAddress.getId(),"MemberAddress","id",resources.getId()); |
72 | MemberAddress.copy(resources); | 76 | _memberAddress.copy(resources); |
73 | this.memberAddressRepository.save(MemberAddress); | 77 | MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress); |
74 | 78 | ||
79 | MemberAddressDTO memberAddressDTO = new MemberAddressDTO(); | ||
80 | BeanUtils.copyProperties(memberAddress, memberAddressDTO); | ||
81 | return memberAddressDTO; | ||
75 | } catch (Exception e) { | 82 | } catch (Exception e) { |
76 | e.printStackTrace(); | 83 | e.printStackTrace(); |
77 | throw e; | 84 | throw e; |
78 | } finally { | 85 | } finally { |
79 | // RedissonUtil.unlock(rLock); | ||
80 | this.redisUtils.doUnLock("MemberAddress::update::code" + resources.getId()); | 86 | this.redisUtils.doUnLock("MemberAddress::update::code" + resources.getId()); |
81 | } | 87 | } |
82 | } | 88 | } | ... | ... |
... | @@ -27,23 +27,24 @@ public class MemberBuilder { | ... | @@ -27,23 +27,24 @@ public class MemberBuilder { |
27 | String code = member.getCode(); | 27 | String code = member.getCode(); |
28 | member.setCode(StringUtils.isEmpty(code)?String.valueOf(IdWorker.generator()):code); | 28 | member.setCode(StringUtils.isEmpty(code)?String.valueOf(IdWorker.generator()):code); |
29 | Integer gender = member.getGender(); | 29 | Integer gender = member.getGender(); |
30 | member.setGender(Objects.nonNull(gender) ? gender : 0); | 30 | member.setGender(Objects.nonNull(gender) ? gender : DEFAULT_VALUE_); |
31 | Integer type = member.getType(); | 31 | Integer type = member.getType(); |
32 | member.setType(Objects.nonNull(type) ? type:-1); | 32 | member.setType(Objects.nonNull(type) ? type:DEFAULT_VALUE_); |
33 | Integer status = member.getStatus(); | 33 | Integer status = member.getStatus(); |
34 | member.setStatus(Objects.nonNull(status) ? status:1); | 34 | member.setStatus(Objects.nonNull(status) ? status:DEFAULT_VALUE_1); |
35 | Integer vip = member.getVip(); | 35 | Integer vip = member.getVip(); |
36 | member.setVip(Objects.nonNull(vip) ? vip:0); | 36 | member.setVip(Objects.nonNull(vip) ? vip:0); |
37 | Integer level = member.getLevel(); | 37 | Integer level = member.getLevel(); |
38 | member.setLevel(Objects.nonNull(level) ? level:1); | 38 | member.setLevel(Objects.nonNull(level) ? level:DEFAULT_VALUE_1); |
39 | member.setExp(DEFAULT_VALUE); | 39 | member.setExp(DEFAULT_VALUE); |
40 | member.setPoints(DEFAULT_VALUE); | 40 | member.setPoints(DEFAULT_VALUE); |
41 | member.setDuePoints(DEFAULT_VALUE); | 41 | member.setDuePoints(DEFAULT_VALUE); |
42 | member.setCouponAmount(DEFAULT_VALUE); | 42 | member.setCouponAmount(DEFAULT_VALUE); |
43 | member.setDueCouponAmount(DEFAULT_VALUE); | 43 | member.setDueCouponAmount(DEFAULT_VALUE); |
44 | member.setBlackStatus(DEFAULT_VALUE); | 44 | member.setBlackStatus(DEFAULT_VALUE); |
45 | member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday()); | ||
45 | String nickname = member.getNickname(); | 46 | String nickname = member.getNickname(); |
46 | if (com.topdraw.utils.StringUtils.isNotEmpty(nickname)) { | 47 | if (StringUtils.isNotEmpty(nickname)) { |
47 | String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); | 48 | String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); |
48 | member.setNickname(base64Nickname); | 49 | member.setNickname(base64Nickname); |
49 | } | 50 | } |
... | @@ -52,21 +53,12 @@ public class MemberBuilder { | ... | @@ -52,21 +53,12 @@ public class MemberBuilder { |
52 | 53 | ||
53 | public static Member build(Integer type,String avatarUrl,String nickname,int vip){ | 54 | public static Member build(Integer type,String avatarUrl,String nickname,int vip){ |
54 | // todo 原型模式 | 55 | // todo 原型模式 |
55 | Member member = new Member(); | 56 | Member member = new Member(); |
56 | member.setType(type); | 57 | member.setType(type); |
57 | member.setBlackStatus(DEFAULT_VALUE); | 58 | member.setAvatarUrl(avatarUrl); |
58 | member.setGender(DEFAULT_VALUE_); | 59 | member.setNickname(nickname); |
59 | member.setVip(vip); | 60 | member.setVip(vip); |
60 | member.setLevel(DEFAULT_VALUE_1); | 61 | Member _member = checkMemberData(member); |
61 | member.setStatus(DEFAULT_VALUE_1); | 62 | return _member; |
62 | member.setPoints(DEFAULT_VALUE); | ||
63 | member.setDuePoints(DEFAULT_VALUE); | ||
64 | member.setExp(DEFAULT_VALUE); | ||
65 | member.setCouponAmount(DEFAULT_VALUE); | ||
66 | member.setDueCouponAmount(DEFAULT_VALUE); | ||
67 | member.setAvatarUrl(StringUtils.isBlank(avatarUrl)?"":avatarUrl); | ||
68 | member.setCode(IdWorker.generator() + ""); | ||
69 | member.setNickname(StringUtils.isBlank(nickname)?"":nickname); | ||
70 | return member; | ||
71 | } | 63 | } |
72 | } | 64 | } | ... | ... |
... | @@ -10,30 +10,24 @@ import java.util.Objects; | ... | @@ -10,30 +10,24 @@ import java.util.Objects; |
10 | public class MemberProfileBuilder { | 10 | public class MemberProfileBuilder { |
11 | 11 | ||
12 | public static MemberProfile build(Member member){ | 12 | public static MemberProfile build(Member member){ |
13 | MemberProfile memberProfile = build(member.getId(),member.getNickname(),member.getGender(),"","","","","","", | 13 | MemberProfile memberProfile = build(member.getId(),member.getCode(),member.getNickname(),member.getGender(),"","","","","","", |
14 | "","","",member.getBirthday()); | 14 | "","","",member.getBirthday()); |
15 | return memberProfile; | 15 | return memberProfile; |
16 | } | 16 | } |
17 | 17 | ||
18 | public static MemberProfile build(Long memberId){ | 18 | public static MemberProfile build(Long memberId){ |
19 | MemberProfile memberProfile = build(memberId,"",-1,"","","","","","", | 19 | MemberProfile memberProfile = build(memberId,"","",-1,"","","","","","", |
20 | "","","",""); | 20 | "","","",""); |
21 | return memberProfile; | 21 | return memberProfile; |
22 | } | 22 | } |
23 | 23 | ||
24 | public static MemberProfile build(Long memberId , String realname , Integer gender, String birthday){ | 24 | public static MemberProfile build(Long memberId ,String memberCode, String realname , Integer gender, String birthday){ |
25 | MemberProfile memberProfile = build(memberId,realname,gender,"","","","","","", | 25 | MemberProfile memberProfile = build(memberId,memberCode,realname,gender,"","","","","","", |
26 | "","","",birthday); | 26 | "","","",birthday); |
27 | return memberProfile; | 27 | return memberProfile; |
28 | } | 28 | } |
29 | 29 | ||
30 | public static MemberProfile build(){ | 30 | public static MemberProfile build(Long memberId,String memberCode, String realName, Integer sex, |
31 | MemberProfile memberProfile = build(null,"",null,"","","","","","", | ||
32 | "","","",null); | ||
33 | return memberProfile; | ||
34 | } | ||
35 | |||
36 | public static MemberProfile build(Long memberId, String realName, Integer sex, | ||
37 | String country, String district, String city, String idCard, String province, | 31 | String country, String district, String city, String idCard, String province, |
38 | String email, String description, String phone, String constellation, | 32 | String email, String description, String phone, String constellation, |
39 | String birthday) { | 33 | String birthday) { |
... | @@ -42,9 +36,10 @@ public class MemberProfileBuilder { | ... | @@ -42,9 +36,10 @@ public class MemberProfileBuilder { |
42 | 36 | ||
43 | MemberProfile memberProfile = new MemberProfile(); | 37 | MemberProfile memberProfile = new MemberProfile(); |
44 | memberProfile.setMemberId(memberId); | 38 | memberProfile.setMemberId(memberId); |
39 | memberProfile.setMemberCode(memberCode); | ||
45 | memberProfile.setRealname(stringIsNull(realName)); | 40 | memberProfile.setRealname(stringIsNull(realName)); |
46 | memberProfile.setGender(sex == null ? 0 : sex); | 41 | memberProfile.setGender(sex == null ? 0 : sex); |
47 | memberProfile.setCountry(stringIsNull(country)); | 42 | memberProfile.setCountry(StringUtils.isBlank(country)?"中国":birthday); |
48 | memberProfile.setDistrict(stringIsNull(district)); | 43 | memberProfile.setDistrict(stringIsNull(district)); |
49 | memberProfile.setCity(stringIsNull(city)); | 44 | memberProfile.setCity(stringIsNull(city)); |
50 | memberProfile.setIdCard(StringUtils.isBlank(idCard)?"000000000000000000":idCard); | 45 | memberProfile.setIdCard(StringUtils.isBlank(idCard)?"000000000000000000":idCard); |
... | @@ -53,7 +48,7 @@ public class MemberProfileBuilder { | ... | @@ -53,7 +48,7 @@ public class MemberProfileBuilder { |
53 | memberProfile.setDescription(stringIsNull(description)); | 48 | memberProfile.setDescription(stringIsNull(description)); |
54 | memberProfile.setPhone(stringIsNull(phone)); | 49 | memberProfile.setPhone(stringIsNull(phone)); |
55 | memberProfile.setConstellation(stringIsNull(constellation)); | 50 | memberProfile.setConstellation(stringIsNull(constellation)); |
56 | memberProfile.setBirthday(stringIsNull(birthday)); | 51 | memberProfile.setBirthday(StringUtils.isBlank(birthday)?"1900-01-01":birthday); |
57 | 52 | ||
58 | return memberProfile; | 53 | return memberProfile; |
59 | } | 54 | } | ... | ... |
1 | package com.topdraw.business.module.member.profile.rest; | 1 | package com.topdraw.business.module.member.profile.rest; |
2 | 2 | ||
3 | import com.topdraw.aop.log.Log; | 3 | import com.topdraw.aop.log.Log; |
4 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | ||
4 | import com.topdraw.common.ResultInfo; | 5 | import com.topdraw.common.ResultInfo; |
5 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 6 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
6 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 7 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
... | @@ -22,15 +23,16 @@ import io.swagger.annotations.*; | ... | @@ -22,15 +23,16 @@ import io.swagger.annotations.*; |
22 | public class MemberProfileController { | 23 | public class MemberProfileController { |
23 | 24 | ||
24 | @Autowired | 25 | @Autowired |
25 | private MemberProfileService memberProfileService; | 26 | private MemberProfileOperationService memberProfileOperationService; |
26 | 27 | ||
27 | @Log("修改会员属性") | 28 | @Log("修改会员属性") |
28 | @RequestMapping(value = "/update") | 29 | @RequestMapping(value = "/update") |
29 | @ApiOperation("修改会员属性") | 30 | @ApiOperation("修改会员属性") |
31 | @Deprecated | ||
30 | public ResultInfo update(@Validated @RequestBody MemberProfile resources) { | 32 | public ResultInfo update(@Validated @RequestBody MemberProfile resources) { |
31 | 33 | ||
32 | log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); | 34 | log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); |
33 | this.memberProfileService.update(resources); | 35 | this.memberProfileOperationService.update(resources); |
34 | log.info("memberProfile ==>> update ==>> result ===>> [{}]",resources); | 36 | log.info("memberProfile ==>> update ==>> result ===>> [{}]",resources); |
35 | 37 | ||
36 | return ResultInfo.success(); | 38 | return ResultInfo.success(); | ... | ... |
... | @@ -53,7 +53,7 @@ public interface MemberProfileService { | ... | @@ -53,7 +53,7 @@ public interface MemberProfileService { |
53 | * 修改 | 53 | * 修改 |
54 | * @param resources | 54 | * @param resources |
55 | */ | 55 | */ |
56 | void update(MemberProfile resources); | 56 | MemberProfileDTO update(MemberProfile resources); |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * 删除 | 59 | * 删除 | ... | ... |
... | @@ -81,7 +81,7 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -81,7 +81,7 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
81 | @Override | 81 | @Override |
82 | @Transactional(rollbackFor = Exception.class) | 82 | @Transactional(rollbackFor = Exception.class) |
83 | public MemberProfile createDefault(MemberProfile resources) { | 83 | public MemberProfile createDefault(MemberProfile resources) { |
84 | MemberProfile memberProfile = MemberProfileBuilder.build(); | 84 | MemberProfile memberProfile = MemberProfileBuilder.build(resources); |
85 | return this.create(memberProfile); | 85 | return this.create(memberProfile); |
86 | } | 86 | } |
87 | 87 | ||
... | @@ -107,7 +107,7 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -107,7 +107,7 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
107 | 107 | ||
108 | @Override | 108 | @Override |
109 | @Transactional(rollbackFor = Exception.class) | 109 | @Transactional(rollbackFor = Exception.class) |
110 | public void update(MemberProfile resources) { | 110 | public MemberProfileDTO update(MemberProfile resources) { |
111 | 111 | ||
112 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | 112 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); |
113 | this.redisUtils.doLock("memberProfile::update::id" + resources.getId()); | 113 | this.redisUtils.doLock("memberProfile::update::id" + resources.getId()); |
... | @@ -122,9 +122,14 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -122,9 +122,14 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
122 | 122 | ||
123 | MemberProfile memberProfile = new MemberProfile(); | 123 | MemberProfile memberProfile = new MemberProfile(); |
124 | BeanUtils.copyProperties(resources,memberProfile); | 124 | BeanUtils.copyProperties(resources,memberProfile); |
125 | this.memberProfileRepository.save(memberProfile); | 125 | MemberProfile _memberProfile = this.memberProfileRepository.save(memberProfile); |
126 | // 同步会员信息 | 126 | // 同步会员信息 |
127 | this.synchronizedMemberData(resources); | 127 | this.synchronizedMemberData(resources); |
128 | |||
129 | MemberProfileDTO memberProfileDTO = new MemberProfileDTO(); | ||
130 | BeanUtils.copyProperties(_memberProfile,memberProfileDTO); | ||
131 | return memberProfileDTO; | ||
132 | |||
128 | } catch (Exception e) { | 133 | } catch (Exception e) { |
129 | e.printStackTrace(); | 134 | e.printStackTrace(); |
130 | throw e; | 135 | throw e; | ... | ... |
... | @@ -6,9 +6,9 @@ import com.topdraw.business.module.common.validated.UpdateGroup; | ... | @@ -6,9 +6,9 @@ import com.topdraw.business.module.common.validated.UpdateGroup; |
6 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; | 6 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; |
7 | import com.topdraw.business.module.member.service.MemberService; | 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.MemberRelatedInfoOperationService; | ||
9 | import com.topdraw.common.ResultInfo; | 10 | import com.topdraw.common.ResultInfo; |
10 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; | 11 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
11 | import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService; | ||
12 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.util.Assert; | 14 | import org.springframework.util.Assert; |
... | @@ -32,7 +32,7 @@ public class MemberRelatedInfoController { | ... | @@ -32,7 +32,7 @@ public class MemberRelatedInfoController { |
32 | @Autowired | 32 | @Autowired |
33 | private MemberService memberService; | 33 | private MemberService memberService; |
34 | @Autowired | 34 | @Autowired |
35 | private MemberRelatedInfoService memberRelatedInfoService; | 35 | private MemberRelatedInfoOperationService memberRelatedInfoOperationService; |
36 | 36 | ||
37 | @Log("新增相关人员") | 37 | @Log("新增相关人员") |
38 | @RequestMapping(value = "/create") | 38 | @RequestMapping(value = "/create") |
... | @@ -40,7 +40,7 @@ public class MemberRelatedInfoController { | ... | @@ -40,7 +40,7 @@ public class MemberRelatedInfoController { |
40 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberRelatedInfo resources) { | 40 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberRelatedInfo resources) { |
41 | log.info("memberRelatedInfo ==>> create ==>> resources ===>> [{}]",resources); | 41 | log.info("memberRelatedInfo ==>> create ==>> resources ===>> [{}]",resources); |
42 | 42 | ||
43 | this.memberRelatedInfoService.create(resources); | 43 | this.memberRelatedInfoOperationService.create(resources); |
44 | 44 | ||
45 | return ResultInfo.success(); | 45 | return ResultInfo.success(); |
46 | } | 46 | } |
... | @@ -53,15 +53,16 @@ public class MemberRelatedInfoController { | ... | @@ -53,15 +53,16 @@ public class MemberRelatedInfoController { |
53 | log.info("memberRelatedInfo ==>> update ==>> resources ===>> [{}]",resources); | 53 | log.info("memberRelatedInfo ==>> update ==>> resources ===>> [{}]",resources); |
54 | 54 | ||
55 | Long id = resources.getId(); | 55 | Long id = resources.getId(); |
56 | MemberRelatedInfoDTO memberRelatedInfoDTO = this.memberRelatedInfoService.findById(id); | 56 | MemberRelatedInfoDTO memberRelatedInfoDTO = this.memberRelatedInfoOperationService.findById(id); |
57 | if (memberRelatedInfoDTO.getId() != null) { | 57 | if (memberRelatedInfoDTO.getId() != null) { |
58 | Long memberId = memberRelatedInfoDTO.getMemberId(); | 58 | Long memberId = memberRelatedInfoDTO.getMemberId(); |
59 | MemberDTO memberDTO = this.memberService.findById(memberId); | 59 | MemberDTO memberDTO = this.memberService.findById(memberId); |
60 | if (Objects.nonNull(memberDTO)) { | 60 | if (Objects.nonNull(memberDTO)) { |
61 | String code = memberDTO.getCode(); | 61 | String code = memberDTO.getCode(); |
62 | Assert.notNull(code,"code can't be null"); | 62 | Assert.notNull(code,"code can't be null"); |
63 | |||
63 | resources.setMemberCode(code); | 64 | resources.setMemberCode(code); |
64 | this.memberRelatedInfoService.update(resources); | 65 | this.memberRelatedInfoOperationService.update(resources); |
65 | } | 66 | } |
66 | } | 67 | } |
67 | 68 | ||
... | @@ -74,7 +75,7 @@ public class MemberRelatedInfoController { | ... | @@ -74,7 +75,7 @@ public class MemberRelatedInfoController { |
74 | @ApiOperation("删除相关人员") | 75 | @ApiOperation("删除相关人员") |
75 | public ResultInfo delete(@PathVariable(value = "id") Long resources) { | 76 | public ResultInfo delete(@PathVariable(value = "id") Long resources) { |
76 | log.info("memberRelatedInfo ==>> delete ==>> resources ===>> [{}]",resources); | 77 | log.info("memberRelatedInfo ==>> delete ==>> resources ===>> [{}]",resources); |
77 | this.memberRelatedInfoService.delete(resources); | 78 | this.memberRelatedInfoOperationService.delete(resources); |
78 | log.info("memberRelatedInfo ==>> delete ==>> result ===>> [{}]",resources); | 79 | log.info("memberRelatedInfo ==>> delete ==>> result ===>> [{}]",resources); |
79 | return ResultInfo.success(); | 80 | return ResultInfo.success(); |
80 | } | 81 | } | ... | ... |
1 | package com.topdraw.business.module.member.rest; | 1 | package com.topdraw.business.module.member.rest; |
2 | 2 | ||
3 | import com.topdraw.annotation.AnonymousAccess; | ||
4 | import com.topdraw.aop.log.Log; | 3 | import com.topdraw.aop.log.Log; |
5 | import com.topdraw.business.module.common.validated.CreateGroup; | 4 | import com.topdraw.business.module.common.validated.CreateGroup; |
6 | import com.topdraw.business.module.common.validated.UpdateGroup; | 5 | import com.topdraw.business.module.common.validated.UpdateGroup; |
7 | import com.topdraw.business.module.member.domain.Member; | 6 | import com.topdraw.business.module.member.domain.Member; |
8 | import com.topdraw.business.module.member.service.MemberService; | ||
9 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
10 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 7 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
11 | import com.topdraw.business.process.service.MemberOperationService; | 8 | import com.topdraw.business.process.service.member.MemberOperationService; |
12 | import com.topdraw.business.process.service.UserOperationService; | 9 | import com.topdraw.business.process.service.UserOperationService; |
13 | import com.topdraw.common.ResultInfo; | 10 | import com.topdraw.common.ResultInfo; |
14 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
... | @@ -42,9 +39,8 @@ public class MemberController { | ... | @@ -42,9 +39,8 @@ public class MemberController { |
42 | public ResultInfo createMemberByUserTv(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) { | 39 | public ResultInfo createMemberByUserTv(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) { |
43 | // todo 此接口废弃,将移动至UserTvController中,AppEngine也要同步修改 | 40 | // todo 此接口废弃,将移动至UserTvController中,AppEngine也要同步修改 |
44 | log.info("member ==>> createMemberByUserTv ==>> param ==>> [{}]",resources); | 41 | log.info("member ==>> createMemberByUserTv ==>> param ==>> [{}]",resources); |
45 | boolean result = this.userTvOperationService.createTvUserAndMember(resources); | 42 | this.userTvOperationService.createTvUserAndMember(resources); |
46 | log.info("member ==>> createMemberByUserTv ==>> result ==>> [{}]",result); | 43 | return ResultInfo.success(); |
47 | return ResultInfo.success(result); | ||
48 | } | 44 | } |
49 | 45 | ||
50 | @Log("手动修改vip") | 46 | @Log("手动修改vip") | ... | ... |
... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.member.service.impl; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.member.service.impl; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.domain.Member; | 3 | import com.topdraw.business.module.member.domain.Member; |
4 | import com.topdraw.business.module.member.domain.MemberBuilder; | 4 | import com.topdraw.business.module.member.domain.MemberBuilder; |
5 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
6 | import com.topdraw.business.module.member.profile.domain.MemberProfileBuilder; | ||
5 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 7 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
6 | import com.topdraw.business.module.member.repository.MemberRepository; | 8 | import com.topdraw.business.module.member.repository.MemberRepository; |
7 | import com.topdraw.business.module.member.service.MemberService; | 9 | import com.topdraw.business.module.member.service.MemberService; |
... | @@ -107,9 +109,11 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -107,9 +109,11 @@ public class MemberServiceImpl implements MemberService { |
107 | Member member = MemberBuilder.build(resources); | 109 | Member member = MemberBuilder.build(resources); |
108 | Long memberId = this.save(member); | 110 | Long memberId = this.save(member); |
109 | 111 | ||
110 | if (Objects.nonNull(memberId)) | 112 | if (Objects.nonNull(memberId)) { |
113 | MemberProfile memberProfile = MemberProfileBuilder.build(member); | ||
111 | // 保存会员属性 | 114 | // 保存会员属性 |
112 | this.memberProfileService.createDefault(member); | 115 | this.memberProfileService.create(memberProfile); |
116 | } | ||
113 | 117 | ||
114 | return this.memberMapper.toDto(member); | 118 | return this.memberMapper.toDto(member); |
115 | 119 | ... | ... |
... | @@ -27,6 +27,10 @@ import java.io.Serializable; | ... | @@ -27,6 +27,10 @@ import java.io.Serializable; |
27 | @Table(name="uc_user_tv") | 27 | @Table(name="uc_user_tv") |
28 | public class UserTv extends AsyncMqModule implements Serializable { | 28 | public class UserTv extends AsyncMqModule implements Serializable { |
29 | 29 | ||
30 | @NotNull(message = "visUserId can't be null !",groups = {CreateGroup.class}) | ||
31 | @Column(name = "vis_user_id") | ||
32 | private Long visUserId; | ||
33 | |||
30 | /** 绑定的小屏账户会员编码 */ | 34 | /** 绑定的小屏账户会员编码 */ |
31 | @Column(name = "priority_member_code") | 35 | @Column(name = "priority_member_code") |
32 | private String priorityMemberCode; | 36 | private String priorityMemberCode; | ... | ... |
... | @@ -5,6 +5,9 @@ import com.topdraw.exception.BadRequestException; | ... | @@ -5,6 +5,9 @@ import com.topdraw.exception.BadRequestException; |
5 | import com.topdraw.exception.GlobeExceptionMsg; | 5 | import com.topdraw.exception.GlobeExceptionMsg; |
6 | import com.topdraw.util.TimestampUtil; | 6 | import com.topdraw.util.TimestampUtil; |
7 | import org.apache.commons.lang3.StringUtils; | 7 | import org.apache.commons.lang3.StringUtils; |
8 | import org.springframework.util.Assert; | ||
9 | |||
10 | import java.util.Objects; | ||
8 | 11 | ||
9 | /** | 12 | /** |
10 | * @author : | 13 | * @author : |
... | @@ -17,41 +20,53 @@ import org.apache.commons.lang3.StringUtils; | ... | @@ -17,41 +20,53 @@ import org.apache.commons.lang3.StringUtils; |
17 | */ | 20 | */ |
18 | public class UserTvBuilder { | 21 | public class UserTvBuilder { |
19 | 22 | ||
23 | private static final Integer DEFAULT_VALUE = 1; | ||
24 | private static final String DEFAULT_CREATE_BY = "system"; | ||
25 | private static final String DEFAULT_UPDATE_BY = "system"; | ||
26 | |||
20 | public static UserTv build(UserTv userTv){ | 27 | public static UserTv build(UserTv userTv){ |
21 | return build(userTv.getMemberCode(),userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(), | 28 | return build(userTv.getMemberId(),userTv.getMemberCode(),userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(), |
22 | userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy()); | 29 | userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy(), userTv.getVisUserId()); |
23 | } | 30 | } |
24 | 31 | ||
25 | public static UserTv build(String memberCode , UserTv userTv){ | 32 | public static UserTv build(Long memberId, String memberCode , UserTv userTv){ |
26 | return build(memberCode,userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(), | 33 | return build(memberId,memberCode,userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(), |
27 | userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy()); | 34 | userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy(), userTv.getVisUserId()); |
28 | } | 35 | } |
29 | 36 | ||
30 | public static UserTv build(Member member ,UserTv userTv){ | 37 | public static UserTv build(String memberCode, UserTv userTv){ |
31 | return build(member.getCode(),userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(), | 38 | return build(null,memberCode,userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(), |
32 | userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy()); | 39 | userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy(), userTv.getVisUserId()); |
33 | } | 40 | } |
34 | 41 | ||
35 | public static UserTv build(String memberCode , Long id , String platformAccount , String nickname , String username, | 42 | public static UserTv build(Member member, UserTv userTv){ |
36 | int loginDays , int status ,int continueDays , String createBy , String updateBy){ | 43 | return build(member.getId() , member.getCode(),userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(), |
44 | userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy(), userTv.getVisUserId()); | ||
45 | } | ||
37 | 46 | ||
38 | if (StringUtils.isBlank(platformAccount)) | 47 | public static UserTv build(Long memberId , String memberCode , Long id , String platformAccount , String nickname , String username, |
39 | throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); | 48 | Integer loginDays , Integer status ,Integer continueDays , String createBy , String updateBy,Long visUserId){ |
49 | Assert.notNull(memberId,GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
50 | Assert.notNull(memberCode,GlobeExceptionMsg.MEMBER_CODE_IS_NULL); | ||
51 | Assert.notNull(platformAccount,GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); | ||
52 | Assert.notNull(platformAccount,GlobeExceptionMsg.VIS_USER_ID_IS_NULL); | ||
40 | 53 | ||
41 | // todo 原型模式 | 54 | // todo 原型模式 |
42 | |||
43 | UserTv userTv = new UserTv(); | 55 | UserTv userTv = new UserTv(); |
44 | userTv.setId(id); | 56 | userTv.setId(id); |
45 | userTv.setPlatformAccount(platformAccount); | 57 | userTv.setPlatformAccount(platformAccount); |
46 | userTv.setMemberCode(memberCode); | 58 | userTv.setMemberCode(memberCode); |
59 | userTv.setMemberId(memberId); | ||
47 | userTv.setNickname(StringUtils.isBlank(nickname)?platformAccount:nickname); | 60 | userTv.setNickname(StringUtils.isBlank(nickname)?platformAccount:nickname); |
48 | userTv.setUsername(StringUtils.isBlank(username)?platformAccount:username); | 61 | userTv.setUsername(StringUtils.isBlank(username)?platformAccount:username); |
49 | userTv.setLoginDays(loginDays); | 62 | userTv.setLoginDays(Objects.nonNull(loginDays)?loginDays:DEFAULT_VALUE); |
50 | userTv.setStatus(status); | 63 | userTv.setLoginType(DEFAULT_VALUE); |
64 | userTv.setStatus(Objects.nonNull(status)?status:DEFAULT_VALUE); | ||
51 | userTv.setActiveTime(TimestampUtil.now()); | 65 | userTv.setActiveTime(TimestampUtil.now()); |
52 | userTv.setContinueDays(continueDays); | 66 | userTv.setContinueDays(Objects.nonNull(continueDays)?loginDays:DEFAULT_VALUE); |
53 | userTv.setCreateBy(StringUtils.isBlank(createBy)?"system":createBy); | 67 | userTv.setCreateBy(StringUtils.isBlank(createBy)?DEFAULT_CREATE_BY:createBy); |
54 | userTv.setUpdateBy(StringUtils.isBlank(updateBy)?"system":updateBy); | 68 | userTv.setUpdateBy(StringUtils.isBlank(updateBy)?DEFAULT_UPDATE_BY:updateBy); |
69 | userTv.setVisUserId(visUserId); | ||
55 | return userTv; | 70 | return userTv; |
56 | } | 71 | } |
57 | 72 | ... | ... |
... | @@ -12,6 +12,8 @@ import java.io.Serializable; | ... | @@ -12,6 +12,8 @@ import java.io.Serializable; |
12 | @Data | 12 | @Data |
13 | public class UserTvDTO implements Serializable { | 13 | public class UserTvDTO implements Serializable { |
14 | 14 | ||
15 | private Long visUserId; | ||
16 | |||
15 | private String memberCode; | 17 | private String memberCode; |
16 | 18 | ||
17 | /** 绑定的小屏账户会员编码 */ | 19 | /** 绑定的小屏账户会员编码 */ | ... | ... |
... | @@ -2,10 +2,13 @@ package com.topdraw.business.process.domian.weixin; | ... | @@ -2,10 +2,13 @@ package com.topdraw.business.process.domian.weixin; |
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | import javax.validation.constraints.NotNull; | ||
6 | |||
5 | @Data | 7 | @Data |
6 | public class BindBean extends WeiXinUserBean { | 8 | public class BindBean extends WeiXinUserBean { |
7 | 9 | ||
8 | private Long platformUserId; | 10 | private Long platformUserId; |
9 | 11 | ||
12 | @NotNull(message = "platformAccount can't be null" , groups = {BindGroup.class}) | ||
10 | private String platformAccount; | 13 | private String platformAccount; |
11 | } | 14 | } | ... | ... |
... | @@ -25,7 +25,6 @@ public class SubscribeBean extends WeiXinUserBean { | ... | @@ -25,7 +25,6 @@ public class SubscribeBean extends WeiXinUserBean { |
25 | /** */ | 25 | /** */ |
26 | private String eventKey; | 26 | private String eventKey; |
27 | 27 | ||
28 | private String unionid; | ||
29 | private String nickname; | 28 | private String nickname; |
30 | private String headimgurl; | 29 | private String headimgurl; |
31 | 30 | ... | ... |
... | @@ -3,6 +3,8 @@ package com.topdraw.business.process.domian.weixin; | ... | @@ -3,6 +3,8 @@ package com.topdraw.business.process.domian.weixin; |
3 | 3 | ||
4 | import lombok.Data; | 4 | import lombok.Data; |
5 | 5 | ||
6 | import javax.validation.constraints.NotNull; | ||
7 | |||
6 | /** | 8 | /** |
7 | * 微信账户信息 | 9 | * 微信账户信息 |
8 | * @author XiangHan | 10 | * @author XiangHan |
... | @@ -13,6 +15,7 @@ public class WeiXinUserBean { | ... | @@ -13,6 +15,7 @@ public class WeiXinUserBean { |
13 | 15 | ||
14 | private Long id; | 16 | private Long id; |
15 | 17 | ||
18 | @NotNull(message = "unionid can't be null" , groups = {BindGroup.class}) | ||
16 | private String unionid; | 19 | private String unionid; |
17 | 20 | ||
18 | /** */ | 21 | /** */ | ... | ... |
... | @@ -3,19 +3,16 @@ package com.topdraw.business.process.rest; | ... | @@ -3,19 +3,16 @@ package com.topdraw.business.process.rest; |
3 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
4 | import com.topdraw.annotation.AnonymousAccess; | 4 | import com.topdraw.annotation.AnonymousAccess; |
5 | import com.topdraw.aop.log.Log; | 5 | import com.topdraw.aop.log.Log; |
6 | import com.topdraw.business.module.common.validated.CreateGroup; | ||
7 | import com.topdraw.business.module.common.validated.UpdateGroup; | 6 | import com.topdraw.business.module.common.validated.UpdateGroup; |
8 | import com.topdraw.business.module.member.domain.Member; | 7 | import com.topdraw.business.module.member.domain.Member; |
9 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 8 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
10 | import com.topdraw.business.module.member.service.MemberService; | ||
11 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 9 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
12 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | 10 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; |
13 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | 11 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; |
14 | import com.topdraw.business.module.user.iptv.domain.UserTv; | ||
15 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | 12 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
16 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 13 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
17 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | 14 | import com.topdraw.business.process.domian.weixin.BuyVipBean; |
18 | import com.topdraw.business.process.service.MemberOperationService; | 15 | import com.topdraw.business.process.service.member.MemberOperationService; |
19 | import com.topdraw.common.IResultInfo; | 16 | import com.topdraw.common.IResultInfo; |
20 | import com.topdraw.common.ResultInfo; | 17 | import com.topdraw.common.ResultInfo; |
21 | import com.topdraw.exception.BadRequestException; | 18 | import com.topdraw.exception.BadRequestException; |
... | @@ -42,19 +39,6 @@ public class MemberOperationController { | ... | @@ -42,19 +39,6 @@ public class MemberOperationController { |
42 | private MemberVipHistoryService memberVipHistoryService; | 39 | private MemberVipHistoryService memberVipHistoryService; |
43 | @Autowired | 40 | @Autowired |
44 | private UserWeixinService userWeixinService; | 41 | private UserWeixinService userWeixinService; |
45 | @Autowired | ||
46 | private MemberService memberService; | ||
47 | |||
48 | @Log("查询会员") | ||
49 | @GetMapping(value = "/findById/{id}") | ||
50 | @ApiOperation("查询会员") | ||
51 | @AnonymousAccess | ||
52 | public ResultInfo findById(@PathVariable(value = "id") Long id) { | ||
53 | log.info("memberOperation ==>> findById ==>> param ==>> [{}]",id); | ||
54 | MemberDTO memberDTO = this.memberOperationService.findById(id); | ||
55 | log.info("memberOperation ==>> findById ==>> result ==>> [{}]",memberDTO); | ||
56 | return ResultInfo.success(memberDTO); | ||
57 | } | ||
58 | 42 | ||
59 | @Log("手动修改vip") | 43 | @Log("手动修改vip") |
60 | @RequestMapping(value = "/doUpdateVipByCode") | 44 | @RequestMapping(value = "/doUpdateVipByCode") |
... | @@ -63,7 +47,7 @@ public class MemberOperationController { | ... | @@ -63,7 +47,7 @@ public class MemberOperationController { |
63 | public ResultInfo doUpdateVipByCode(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) { | 47 | public ResultInfo doUpdateVipByCode(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) { |
64 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); | 48 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); |
65 | 49 | ||
66 | MemberDTO memberDTO = this.memberService.findByCode(resources.getCode()); | 50 | MemberDTO memberDTO = this.memberOperationService.findByCode(resources.getCode()); |
67 | resources.setId(memberDTO.getId()); | 51 | resources.setId(memberDTO.getId()); |
68 | this.memberOperationService.update(resources); | 52 | this.memberOperationService.update(resources); |
69 | log.info("member ==>> doUpdateVipByCode ==>> result ==>> [{}]",resources); | 53 | log.info("member ==>> doUpdateVipByCode ==>> result ==>> [{}]",resources); |
... | @@ -105,7 +89,7 @@ public class MemberOperationController { | ... | @@ -105,7 +89,7 @@ public class MemberOperationController { |
105 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id); | 89 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id); |
106 | Long memberId = userWeixinDTO.getMemberId(); | 90 | Long memberId = userWeixinDTO.getMemberId(); |
107 | 91 | ||
108 | MemberDTO member = this.memberService.findById(memberId); | 92 | MemberDTO member = this.memberOperationService.findById(memberId); |
109 | 93 | ||
110 | LocalDateTime now = LocalDateTime.now(); | 94 | LocalDateTime now = LocalDateTime.now(); |
111 | 95 | ... | ... |
... | @@ -13,15 +13,14 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; | ... | @@ -13,15 +13,14 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; |
13 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 13 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
14 | import com.topdraw.business.module.user.iptv.service.UserTvService; | 14 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
15 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 15 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
16 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
16 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 17 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
17 | import com.topdraw.business.process.domian.weixin.BindBean; | 18 | import com.topdraw.business.process.domian.weixin.*; |
18 | import com.topdraw.business.process.domian.weixin.SubscribeBean; | ||
19 | import com.topdraw.business.process.domian.weixin.SubscribeBeanEvent; | ||
20 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
21 | import com.topdraw.business.process.service.UserOperationService; | 19 | import com.topdraw.business.process.service.UserOperationService; |
22 | import com.topdraw.common.ResultInfo; | 20 | import com.topdraw.common.ResultInfo; |
23 | import com.topdraw.config.RedisKeyUtil; | 21 | import com.topdraw.config.RedisKeyUtil; |
24 | import com.topdraw.exception.BadRequestException; | 22 | import com.topdraw.exception.BadRequestException; |
23 | import com.topdraw.exception.GlobeExceptionMsg; | ||
25 | import com.topdraw.util.Base64Util; | 24 | import com.topdraw.util.Base64Util; |
26 | import com.topdraw.util.JSONUtil; | 25 | import com.topdraw.util.JSONUtil; |
27 | import com.topdraw.utils.RedisUtils; | 26 | import com.topdraw.utils.RedisUtils; |
... | @@ -47,13 +46,9 @@ import java.util.*; | ... | @@ -47,13 +46,9 @@ import java.util.*; |
47 | public class UserOperationController { | 46 | public class UserOperationController { |
48 | 47 | ||
49 | @Autowired | 48 | @Autowired |
50 | private UserTvService userTvService; | ||
51 | @Autowired | ||
52 | private MemberService memberService; | 49 | private MemberService memberService; |
53 | @Autowired | 50 | @Autowired |
54 | private UserOperationService userOperationService; | 51 | private UserOperationService userOperationService; |
55 | @Autowired | ||
56 | private UserOperationService userTvOperationService; | ||
57 | 52 | ||
58 | @Autowired | 53 | @Autowired |
59 | private RedisUtils redisUtils; | 54 | private RedisUtils redisUtils; |
... | @@ -62,81 +57,36 @@ public class UserOperationController { | ... | @@ -62,81 +57,36 @@ public class UserOperationController { |
62 | private static final String UNSUBSCRIBE = "unsubscribe"; | 57 | private static final String UNSUBSCRIBE = "unsubscribe"; |
63 | private static final Integer SUBSCRIBE_STATUS = 1; | 58 | private static final Integer SUBSCRIBE_STATUS = 1; |
64 | 59 | ||
65 | @Log("保存大屏账户同时创建会员") | 60 | @Log("新增小屏账户同时创建会员信息") |
66 | @PostMapping(value = "/createTvUserAndMember") | 61 | @PostMapping(value = "/createWeixinUserAndCreateMember") |
67 | @ApiOperation("保存大屏账户同时创建会员信息") | 62 | @ApiOperation("新增小屏账户同时创建会员信息") |
68 | @AnonymousAccess | 63 | @AnonymousAccess |
69 | public ResultInfo createTvUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) { | 64 | public ResultInfo createWeixinUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) { |
70 | log.info("UserOperationController ==> createUserAndCreateMember ==>> param ==> [{}]",resources); | 65 | log.info("UserOperationController ==> createWeixinUserAndMember ==> param ==> [{}]",resources); |
71 | 66 | ||
72 | boolean result = this.userTvOperationService.createTvUserAndMember(resources); | 67 | UserWeixinDTO result = this.userOperationService.createWeixinUserAndMember(resources); |
73 | return ResultInfo.success(result); | 68 | return ResultInfo.success(result); |
74 | } | 69 | } |
75 | 70 | ||
76 | @Log("大屏用户解绑") | ||
77 | @RequestMapping(value = "/unbind") | ||
78 | @ApiOperation("大屏用户解绑") | ||
79 | @AnonymousAccess | ||
80 | public ResultInfo unbind(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) { | ||
81 | log.info("UserOperationController ==> unbind ==>> param ==> [{}]",resources); | ||
82 | |||
83 | this.userTvOperationService.unbind(resources); | ||
84 | return ResultInfo.success(); | ||
85 | } | ||
86 | |||
87 | @Log("大屏更换主账号") | ||
88 | @RequestMapping(value = "/changeMainAccount") | ||
89 | @ApiOperation("大屏更换主账号") | ||
90 | @AnonymousAccess | ||
91 | public ResultInfo changeMainAccount(@Validated @RequestBody UserTv resources) { | ||
92 | log.info("UserOperationController ==> changeMainAccount ==>> param ==> [{}]",resources); | ||
93 | |||
94 | this.userTvOperationService.changeMainAccount(resources); | ||
95 | return ResultInfo.success(); | ||
96 | } | ||
97 | |||
98 | @Log("微信服务号(H5)登录") | 71 | @Log("微信服务号(H5)登录") |
99 | @PostMapping("/serviceLogin") | 72 | @PostMapping("/serviceLogin") |
100 | @ApiOperation("微信服务号(H5)登录") | 73 | @ApiOperation("微信服务号(H5)登录") |
101 | @AnonymousAccess | 74 | @AnonymousAccess |
102 | public ResultInfo serviceLogin(@Validated @RequestBody WeiXinUserBean resources) { | 75 | public ResultInfo serviceLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) { |
103 | log.info("UserOperationController ==> serviceLogin ==>> param ==> [{}]",resources); | 76 | log.info("UserOperationController ==> serviceLogin ==>> param ==> [{}]",resources); |
104 | 77 | ||
105 | Object o = this.userTvOperationService.serviceLogin(resources); | 78 | UserWeixinDTO result = this.userOperationService.serviceLogin(resources); |
106 | return ResultInfo.success(o); | 79 | return ResultInfo.success(result); |
107 | } | 80 | } |
108 | 81 | ||
109 | @Log("微信小程序登录") | 82 | @Log("微信小程序登录") |
110 | @PostMapping("/appletLogin") | 83 | @PostMapping("/appletLogin") |
111 | @ApiOperation("微信小程序登录") | 84 | @ApiOperation("微信小程序登录") |
112 | @AnonymousAccess | 85 | @AnonymousAccess |
113 | public ResultInfo appletLogin(@Validated @RequestBody WeiXinUserBean resources) { | 86 | public ResultInfo appletLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) { |
114 | log.info("UserOperationController ==> appletLogin ==>> param ==> [{}]",resources); | 87 | log.info("UserOperationController ==> appletLogin ==>> param ==> [{}]",resources); |
115 | 88 | ||
116 | UserWeixinDTO result = this.userTvOperationService.appletLogin(resources); | 89 | UserWeixinDTO result = this.userOperationService.appletLogin(resources); |
117 | return ResultInfo.success(result); | ||
118 | } | ||
119 | |||
120 | @Log("微信小程序绑定大屏") | ||
121 | @PostMapping("/appletBind") | ||
122 | @ApiOperation("微信小程序绑定大屏") | ||
123 | @AnonymousAccess | ||
124 | public ResultInfo appletBind(@Validated @RequestBody BindBean resources) { | ||
125 | log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources); | ||
126 | |||
127 | String unionId = resources.getUnionid(); | ||
128 | if (StringUtils.isBlank(unionId)) | ||
129 | Assert.state(StrUtil.isNotBlank(unionId), "跨屏绑定,请先进行授权"); | ||
130 | |||
131 | String platformAccount = resources.getPlatformAccount(); | ||
132 | if (Objects.isNull(platformAccount)) | ||
133 | Assert.state(StrUtil.isNotBlank(platformAccount), "大屏账户不得为空"); | ||
134 | |||
135 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
136 | resources.setPlatformUserId(userTvDTO.getId()); | ||
137 | resources.setPlatformAccount(platformAccount); | ||
138 | |||
139 | boolean result = this.userTvOperationService.appletBind(resources); | ||
140 | return ResultInfo.success(result); | 90 | return ResultInfo.success(result); |
141 | } | 91 | } |
142 | 92 | ||
... | @@ -148,8 +98,9 @@ public class UserOperationController { | ... | @@ -148,8 +98,9 @@ public class UserOperationController { |
148 | log.info("UserOperationController ==> subscribe ==>> param ==> [{}]",data); | 98 | log.info("UserOperationController ==> subscribe ==>> param ==> [{}]",data); |
149 | 99 | ||
150 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class); | 100 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class); |
101 | // 解析参数 | ||
151 | this.parseSubscribe(subscribeBean); | 102 | this.parseSubscribe(subscribeBean); |
152 | boolean result = this.userTvOperationService.subscribe(subscribeBean); | 103 | boolean result = this.userOperationService.subscribe(subscribeBean); |
153 | return ResultInfo.success(result); | 104 | return ResultInfo.success(result); |
154 | } | 105 | } |
155 | 106 | ||
... | @@ -159,74 +110,57 @@ public class UserOperationController { | ... | @@ -159,74 +110,57 @@ public class UserOperationController { |
159 | * @throws IOException | 110 | * @throws IOException |
160 | */ | 111 | */ |
161 | private void parseSubscribe(SubscribeBean subscribeBean) throws IOException { | 112 | private void parseSubscribe(SubscribeBean subscribeBean) throws IOException { |
162 | if (Objects.nonNull(subscribeBean)) { | ||
163 | |||
164 | String appId = subscribeBean.getAppId(); | ||
165 | // appId不得为空 | ||
166 | if (StringUtils.isBlank(appId)) | ||
167 | throw new BadRequestException("appId 不存在!"); | ||
168 | |||
169 | // openId | ||
170 | String openId = subscribeBean.getOpenId(); | ||
171 | if (StringUtils.isBlank(openId)) | ||
172 | throw new BadRequestException("openId 不存在!"); | ||
173 | |||
174 | // unionId | ||
175 | String unionId = subscribeBean.getUnionid(); | ||
176 | if (StringUtils.isBlank(unionId)) | ||
177 | throw new BadRequestException("unionId 不存在!"); | ||
178 | |||
179 | // 匹配配置文件中的微信列表信息 | ||
180 | Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appId); | ||
181 | |||
182 | if (Objects.nonNull(wxInfoMap)) { | ||
183 | // 程序类型 | ||
184 | String appType = wxInfoMap.get("appType"); | ||
185 | // 非订阅号,暂不处理。返回暂不支持 | ||
186 | if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION)) | ||
187 | throw new BadRequestException("非订阅号"); | ||
188 | } | ||
189 | |||
190 | // 大屏账户信息 | ||
191 | JSONObject iptvUserInfo = null; | ||
192 | // 缓存的大屏信息,使用unionid即可 | ||
193 | String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId)); | ||
194 | if (StringUtils.isNotBlank(content)) { | ||
195 | // 大屏信息 | ||
196 | iptvUserInfo = JSONObject.parseObject(content); | ||
197 | 113 | ||
198 | } else { | 114 | String appId = subscribeBean.getAppId(); |
199 | 115 | Assert.notNull(appId, GlobeExceptionMsg.APP_ID_IS_NULL); | |
200 | String eventKey = subscribeBean.getEventKey(); | 116 | // openId |
201 | log.info(" eventKey ==> [{}] ", eventKey); | 117 | String openId = subscribeBean.getOpenId(); |
118 | Assert.notNull(openId, GlobeExceptionMsg.OPEN_ID_IS_NULL); | ||
119 | // unionId | ||
120 | String unionId = subscribeBean.getUnionid(); | ||
121 | Assert.notNull(openId, GlobeExceptionMsg.UNION_ID_IS_NULL); | ||
122 | |||
123 | subscribeBean.setAppid(appId); | ||
124 | subscribeBean.setOpenid(openId); | ||
125 | subscribeBean.setUnionid(unionId); | ||
126 | |||
127 | // 匹配配置文件中的微信列表信息 | ||
128 | Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appId); | ||
129 | |||
130 | if (Objects.nonNull(wxInfoMap)) { | ||
131 | // 程序类型 | ||
132 | String appType = wxInfoMap.get("appType"); | ||
133 | // 非订阅号,暂不处理。返回暂不支持 | ||
134 | if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION)) | ||
135 | throw new BadRequestException("非订阅号"); | ||
136 | } | ||
202 | 137 | ||
203 | if (StringUtils.isNotBlank(eventKey)) { | 138 | // 大屏账户信息 |
204 | // 用户扫描带参二维码关注。发消息 | 139 | JSONObject iptvUserInfo = null; |
205 | // 去除固定前缀,获取二维码参数 | 140 | // 缓存的大屏信息,使用unionid即可 |
206 | eventKey = eventKey.substring(8); | 141 | String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId)); |
207 | iptvUserInfo = JSONObject.parseObject(eventKey); | 142 | if (StringUtils.isNotBlank(content)) { |
208 | } | 143 | // 大屏信息 |
144 | iptvUserInfo = JSONObject.parseObject(content); | ||
209 | 145 | ||
210 | } | 146 | } |
211 | 147 | ||
212 | // 用户自己搜索关注就没有大屏信息,否则表示扫码关注 | 148 | // 用户自己搜索关注就没有大屏信息,否则表示扫码关注 |
213 | if (Objects.nonNull(iptvUserInfo)) { | 149 | if (Objects.nonNull(iptvUserInfo)) { |
214 | 150 | ||
215 | subscribeBean.setIptvUserInfo(iptvUserInfo); | 151 | subscribeBean.setIptvUserInfo(iptvUserInfo); |
216 | 152 | ||
217 | String headimgurl = iptvUserInfo.get("headimgurl").toString(); | 153 | String headimgurl = iptvUserInfo.get("headimgurl").toString(); |
218 | String nickname = iptvUserInfo.get("nickname").toString(); | 154 | String nickname = iptvUserInfo.get("nickname").toString(); |
219 | if (StringUtils.isNotBlank(nickname)) { | 155 | if (StringUtils.isNotBlank(nickname)) { |
220 | String nicknameDecode = URLDecoder.decode(nickname, "UTF-8"); | 156 | String nicknameDecode = URLDecoder.decode(nickname, "UTF-8"); |
221 | String nicknameEncode = Base64Util.encode(nicknameDecode); | 157 | String nicknameEncode = Base64Util.encode(nicknameDecode); |
222 | subscribeBean.setNickname(nicknameEncode); | 158 | subscribeBean.setNickname(nicknameEncode); |
223 | } | 159 | } |
224 | |||
225 | if (StringUtils.isNotBlank(headimgurl)) { | ||
226 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); | ||
227 | subscribeBean.setHeadimgurl(headimgurlDecode); | ||
228 | } | ||
229 | 160 | ||
161 | if (StringUtils.isNotBlank(headimgurl)) { | ||
162 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); | ||
163 | subscribeBean.setHeadimgurl(headimgurlDecode); | ||
230 | } | 164 | } |
231 | 165 | ||
232 | } | 166 | } |
... | @@ -240,7 +174,28 @@ public class UserOperationController { | ... | @@ -240,7 +174,28 @@ public class UserOperationController { |
240 | log.info("UserOperationController ==> unsubscribe ==>> param ==> [{}]",data); | 174 | log.info("UserOperationController ==> unsubscribe ==>> param ==> [{}]",data); |
241 | 175 | ||
242 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class); | 176 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class); |
243 | boolean result = this.userTvOperationService.unsubscribe(subscribeBean); | 177 | |
178 | String appId = subscribeBean.getAppId(); | ||
179 | Assert.notNull(appId, GlobeExceptionMsg.APP_ID_IS_NULL); | ||
180 | // openId | ||
181 | String openId = subscribeBean.getOpenId(); | ||
182 | Assert.notNull(openId, GlobeExceptionMsg.OPEN_ID_IS_NULL); | ||
183 | |||
184 | subscribeBean.setAppid(appId); | ||
185 | subscribeBean.setOpenid(openId); | ||
186 | |||
187 | boolean result = this.userOperationService.unsubscribe(subscribeBean); | ||
188 | return ResultInfo.success(result); | ||
189 | } | ||
190 | |||
191 | @Log("微信小程序绑定大屏") | ||
192 | @PostMapping("/appletBind") | ||
193 | @ApiOperation("微信小程序绑定大屏") | ||
194 | @AnonymousAccess | ||
195 | public ResultInfo appletBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) { | ||
196 | log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources); | ||
197 | |||
198 | boolean result = this.userOperationService.appletBind(resources); | ||
244 | return ResultInfo.success(result); | 199 | return ResultInfo.success(result); |
245 | } | 200 | } |
246 | 201 | ||
... | @@ -263,7 +218,7 @@ public class UserOperationController { | ... | @@ -263,7 +218,7 @@ public class UserOperationController { |
263 | String result = SUBSCRIBE; | 218 | String result = SUBSCRIBE; |
264 | 219 | ||
265 | // 保存大小屏信息到redis同时返回小屏信息 | 220 | // 保存大小屏信息到redis同时返回小屏信息 |
266 | UserWeixinDTO userWeixinDTO = this.userTvOperationService.saveUserInfo(data); | 221 | UserWeixinDTO userWeixinDTO = this.userOperationService.saveUserInfo(data); |
267 | // 小屏用户不存在或者关注状态为未关注(0),返回未关注 | 222 | // 小屏用户不存在或者关注状态为未关注(0),返回未关注 |
268 | if (Objects.isNull(userWeixinDTO) || Objects.isNull(userWeixinDTO.getId()) || userWeixinDTO.getStatus() != SUBSCRIBE_STATUS) { | 223 | if (Objects.isNull(userWeixinDTO) || Objects.isNull(userWeixinDTO.getId()) || userWeixinDTO.getStatus() != SUBSCRIBE_STATUS) { |
269 | result = UNSUBSCRIBE; | 224 | result = UNSUBSCRIBE; |
... | @@ -325,6 +280,41 @@ public class UserOperationController { | ... | @@ -325,6 +280,41 @@ public class UserOperationController { |
325 | } | 280 | } |
326 | 281 | ||
327 | 282 | ||
283 | /******************************************************* IPTV ************************************/ | ||
284 | |||
285 | @Log("保存大屏账户同时创建会员") | ||
286 | @PostMapping(value = "/createTvUserAndMember") | ||
287 | @ApiOperation("保存大屏账户同时创建会员信息") | ||
288 | @AnonymousAccess | ||
289 | public ResultInfo createTvUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) { | ||
290 | log.info("UserOperationController ==> createUserAndCreateMember ==>> param ==> [{}]",resources); | ||
291 | |||
292 | UserTvDTO result = this.userOperationService.createTvUserAndMember(resources); | ||
293 | return ResultInfo.success(result); | ||
294 | } | ||
295 | |||
296 | @Log("大屏用户解绑") | ||
297 | @RequestMapping(value = "/unbind") | ||
298 | @ApiOperation("大屏用户解绑") | ||
299 | @AnonymousAccess | ||
300 | public ResultInfo unbind(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) { | ||
301 | log.info("UserOperationController ==> unbind ==>> param ==> [{}]",resources); | ||
302 | |||
303 | this.userOperationService.unbind(resources); | ||
304 | return ResultInfo.success(); | ||
305 | } | ||
306 | |||
307 | @Log("大屏更换主账号") | ||
308 | @RequestMapping(value = "/changeMainAccount") | ||
309 | @ApiOperation("大屏更换主账号") | ||
310 | @AnonymousAccess | ||
311 | public ResultInfo changeMainAccount(@Validated @RequestBody UserTv resources) { | ||
312 | log.info("UserOperationController ==> changeMainAccount ==>> param ==> [{}]",resources); | ||
313 | |||
314 | this.userOperationService.changeMainAccount(resources); | ||
315 | return ResultInfo.success(); | ||
316 | } | ||
317 | |||
328 | @Log("删除全部收藏") | 318 | @Log("删除全部收藏") |
329 | @PostMapping(value = "/deleteAllCollection") | 319 | @PostMapping(value = "/deleteAllCollection") |
330 | @ApiOperation("删除全部收藏") | 320 | @ApiOperation("删除全部收藏") |
... | @@ -332,7 +322,7 @@ public class UserOperationController { | ... | @@ -332,7 +322,7 @@ public class UserOperationController { |
332 | public ResultInfo deleteAllCollection(@RequestBody String content) { | 322 | public ResultInfo deleteAllCollection(@RequestBody String content) { |
333 | log.info("UserOperationController ==> deleteAllCollection ==> param ==> [{}]",content); | 323 | log.info("UserOperationController ==> deleteAllCollection ==> param ==> [{}]",content); |
334 | 324 | ||
335 | boolean result = this.userTvOperationService.deleteAllCollection(content); | 325 | boolean result = this.userOperationService.deleteAllCollection(content); |
336 | return ResultInfo.success(result); | 326 | return ResultInfo.success(result); |
337 | } | 327 | } |
338 | 328 | ||
... | @@ -343,7 +333,7 @@ public class UserOperationController { | ... | @@ -343,7 +333,7 @@ public class UserOperationController { |
343 | public ResultInfo deleteCollection(@RequestBody String content) { | 333 | public ResultInfo deleteCollection(@RequestBody String content) { |
344 | log.info("UserOperationController ==> deleteCollection ==> param ==> [{}]",content); | 334 | log.info("UserOperationController ==> deleteCollection ==> param ==> [{}]",content); |
345 | 335 | ||
346 | boolean result = this.userTvOperationService.deleteCollection(content); | 336 | boolean result = this.userOperationService.deleteCollection(content); |
347 | return ResultInfo.success(result); | 337 | return ResultInfo.success(result); |
348 | } | 338 | } |
349 | 339 | ||
... | @@ -354,7 +344,7 @@ public class UserOperationController { | ... | @@ -354,7 +344,7 @@ public class UserOperationController { |
354 | public ResultInfo addCollection(@RequestBody String content) { | 344 | public ResultInfo addCollection(@RequestBody String content) { |
355 | log.info("UserOperationController ==> addCollection ==>> param ==> [{}]",content); | 345 | log.info("UserOperationController ==> addCollection ==>> param ==> [{}]",content); |
356 | 346 | ||
357 | boolean result = this.userTvOperationService.addCollection(content); | 347 | boolean result = this.userOperationService.addCollection(content); |
358 | return ResultInfo.success(result); | 348 | return ResultInfo.success(result); |
359 | } | 349 | } |
360 | 350 | ... | ... |
... | @@ -17,14 +17,28 @@ public interface UserOperationService { | ... | @@ -17,14 +17,28 @@ public interface UserOperationService { |
17 | * @param resources | 17 | * @param resources |
18 | * @return | 18 | * @return |
19 | */ | 19 | */ |
20 | boolean createTvUserAndMember(UserTv resources); | 20 | UserTvDTO createTvUserAndMember(UserTv resources); |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * 保存小屏账户并创建会员 | 23 | * 保存小屏账户并创建会员 |
24 | * @param resources | 24 | * @param resources |
25 | * @return | 25 | * @return |
26 | */ | 26 | */ |
27 | UserWeixinDTO createWeixinUserAndCreateMember(UserWeixin resources); | 27 | UserWeixinDTO createWeixinUserAndMember(UserWeixin resources); |
28 | |||
29 | /** | ||
30 | * 服务号(H5)登录 | ||
31 | * @param resources | ||
32 | * @return | ||
33 | */ | ||
34 | UserWeixinDTO serviceLogin(UserWeixin resources); | ||
35 | |||
36 | /** | ||
37 | * 微信小程序登录 | ||
38 | * @param resources | ||
39 | * @return | ||
40 | */ | ||
41 | UserWeixinDTO appletLogin(UserWeixin resources); | ||
28 | 42 | ||
29 | /** | 43 | /** |
30 | * 大屏解绑 | 44 | * 大屏解绑 |
... | @@ -38,12 +52,7 @@ public interface UserOperationService { | ... | @@ -38,12 +52,7 @@ public interface UserOperationService { |
38 | */ | 52 | */ |
39 | void changeMainAccount(UserTv userTv); | 53 | void changeMainAccount(UserTv userTv); |
40 | 54 | ||
41 | /** | 55 | |
42 | * 微信小程序登录 | ||
43 | * @param resources | ||
44 | * @return | ||
45 | */ | ||
46 | UserWeixinDTO appletLogin(WeiXinUserBean resources); | ||
47 | 56 | ||
48 | /** | 57 | /** |
49 | * 微信公众号关注 | 58 | * 微信公众号关注 |
... | @@ -91,21 +100,12 @@ public interface UserOperationService { | ... | @@ -91,21 +100,12 @@ public interface UserOperationService { |
91 | boolean addCollection(String content); | 100 | boolean addCollection(String content); |
92 | 101 | ||
93 | /** | 102 | /** |
94 | * 服务号(H5)登录 | ||
95 | * @param resources | ||
96 | * @return | ||
97 | */ | ||
98 | Object serviceLogin(WeiXinUserBean resources); | ||
99 | |||
100 | /** | ||
101 | * 小程序绑定大屏 | 103 | * 小程序绑定大屏 |
102 | * @param resources | 104 | * @param resources |
103 | * @return | 105 | * @return |
104 | */ | 106 | */ |
105 | boolean appletBind(BindBean resources); | 107 | boolean appletBind(BindBean resources); |
106 | 108 | ||
107 | |||
108 | |||
109 | /** | 109 | /** |
110 | * | 110 | * |
111 | * @param memberCode | 111 | * @param memberCode | ... | ... |
... | @@ -8,7 +8,7 @@ import com.topdraw.business.module.member.domain.Member; | ... | @@ -8,7 +8,7 @@ import com.topdraw.business.module.member.domain.Member; |
8 | import com.topdraw.business.module.member.service.MemberService; | 8 | import com.topdraw.business.module.member.service.MemberService; |
9 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 9 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
10 | import com.topdraw.business.process.service.CouponOperationService; | 10 | import com.topdraw.business.process.service.CouponOperationService; |
11 | import com.topdraw.business.process.service.MemberOperationService; | 11 | import com.topdraw.business.process.service.member.MemberOperationService; |
12 | import com.topdraw.business.process.domian.TempCoupon; | 12 | import com.topdraw.business.process.domian.TempCoupon; |
13 | import com.topdraw.business.process.service.RightsOperationService; | 13 | import com.topdraw.business.process.service.RightsOperationService; |
14 | import com.topdraw.utils.RedisUtils; | 14 | import com.topdraw.utils.RedisUtils; | ... | ... |
... | @@ -9,7 +9,7 @@ import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; | ... | @@ -9,7 +9,7 @@ import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
9 | import com.topdraw.business.module.member.service.MemberService; | 9 | import com.topdraw.business.module.member.service.MemberService; |
10 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 10 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
11 | import com.topdraw.business.process.service.ExpOperationService; | 11 | import com.topdraw.business.process.service.ExpOperationService; |
12 | import com.topdraw.business.process.service.MemberOperationService; | 12 | import com.topdraw.business.process.service.member.MemberOperationService; |
13 | import com.topdraw.business.process.domian.TempExp; | 13 | import com.topdraw.business.process.domian.TempExp; |
14 | import com.topdraw.util.IdWorker; | 14 | import com.topdraw.util.IdWorker; |
15 | import com.topdraw.utils.RedisUtils; | 15 | import com.topdraw.utils.RedisUtils; | ... | ... |
... | @@ -13,7 +13,7 @@ import com.topdraw.business.module.points.detail.domain.PointsDetail; | ... | @@ -13,7 +13,7 @@ import com.topdraw.business.module.points.detail.domain.PointsDetail; |
13 | import com.topdraw.business.module.points.detail.service.PointsDetailService; | 13 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
14 | import com.topdraw.business.module.points.service.PointsService; | 14 | import com.topdraw.business.module.points.service.PointsService; |
15 | import com.topdraw.business.process.service.dto.CustomPointsResult; | 15 | import com.topdraw.business.process.service.dto.CustomPointsResult; |
16 | import com.topdraw.business.process.service.MemberOperationService; | 16 | import com.topdraw.business.process.service.member.MemberOperationService; |
17 | import com.topdraw.business.process.service.PointsOperationService; | 17 | import com.topdraw.business.process.service.PointsOperationService; |
18 | import com.topdraw.business.process.domian.TempPoints; | 18 | import com.topdraw.business.process.domian.TempPoints; |
19 | import com.topdraw.util.IdWorker; | 19 | import com.topdraw.util.IdWorker; | ... | ... |
... | @@ -12,6 +12,7 @@ import com.topdraw.business.module.member.service.MemberService; | ... | @@ -12,6 +12,7 @@ import com.topdraw.business.module.member.service.MemberService; |
12 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 12 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
13 | import com.topdraw.business.module.user.iptv.domain.UserConstant; | 13 | import com.topdraw.business.module.user.iptv.domain.UserConstant; |
14 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 14 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
15 | import com.topdraw.business.module.user.iptv.domain.UserTvBuilder; | ||
15 | import com.topdraw.business.module.user.iptv.service.UserTvService; | 16 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
16 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 17 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
17 | import com.topdraw.business.module.user.weixin.collection.domain.UserCollection; | 18 | import com.topdraw.business.module.user.weixin.collection.domain.UserCollection; |
... | @@ -20,6 +21,7 @@ import com.topdraw.business.module.user.weixin.collection.repository.UserCollect | ... | @@ -20,6 +21,7 @@ import com.topdraw.business.module.user.weixin.collection.repository.UserCollect |
20 | import com.topdraw.business.module.user.weixin.collection.service.UserCollectionDetailService; | 21 | import com.topdraw.business.module.user.weixin.collection.service.UserCollectionDetailService; |
21 | import com.topdraw.business.module.user.weixin.collection.service.UserCollectionService; | 22 | import com.topdraw.business.module.user.weixin.collection.service.UserCollectionService; |
22 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 23 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
24 | import com.topdraw.business.module.user.weixin.domain.UserWeixinBuilder; | ||
23 | import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository; | 25 | import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository; |
24 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | 26 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
25 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 27 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
... | @@ -45,6 +47,7 @@ import org.springframework.data.domain.Sort; | ... | @@ -45,6 +47,7 @@ import org.springframework.data.domain.Sort; |
45 | import org.springframework.stereotype.Service; | 47 | import org.springframework.stereotype.Service; |
46 | import org.springframework.transaction.annotation.Propagation; | 48 | import org.springframework.transaction.annotation.Propagation; |
47 | import org.springframework.transaction.annotation.Transactional; | 49 | import org.springframework.transaction.annotation.Transactional; |
50 | import org.springframework.util.Assert; | ||
48 | 51 | ||
49 | import java.nio.charset.StandardCharsets; | 52 | import java.nio.charset.StandardCharsets; |
50 | import java.time.LocalDateTime; | 53 | import java.time.LocalDateTime; |
... | @@ -91,15 +94,15 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -91,15 +94,15 @@ public class UserOperationServiceImpl implements UserOperationService { |
91 | private String appletAppid; | 94 | private String appletAppid; |
92 | 95 | ||
93 | /** | 96 | /** |
94 | * 保存大屏账户同时创建会员 | 97 | * 创建大屏账户同时创建会员 |
95 | * | 98 | * |
96 | * @param resources 大屏账户 | 99 | * @param resources 大屏账户 |
97 | * @return boolean | 100 | * @return UserTvDTO |
98 | */ | 101 | */ |
99 | @Override | 102 | @Override |
100 | @Transactional | 103 | @Transactional |
101 | @AsyncMqSend | 104 | @AsyncMqSend |
102 | public boolean createTvUserAndMember(UserTv resources) { | 105 | public UserTvDTO createTvUserAndMember(UserTv resources) { |
103 | // 大屏账户 | 106 | // 大屏账户 |
104 | String platformAccount = resources.getPlatformAccount(); | 107 | String platformAccount = resources.getPlatformAccount(); |
105 | 108 | ||
... | @@ -111,14 +114,19 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -111,14 +114,19 @@ public class UserOperationServiceImpl implements UserOperationService { |
111 | Member member = | 114 | Member member = |
112 | MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS, | 115 | MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS, |
113 | null, platformAccount, 0); | 116 | null, platformAccount, 0); |
117 | MemberDTO memberDTO = this.createMember(member); | ||
114 | 118 | ||
115 | UserTvDTO _userTvDTO = new UserTvDTO(); | 119 | if (Objects.nonNull(memberDTO)) { |
116 | BeanUtils.copyProperties(resources, _userTvDTO); | ||
117 | 120 | ||
118 | // 创建大屏账户 | 121 | UserTv userTv = UserTvBuilder.build(memberDTO.getId(), memberDTO.getCode(), resources); |
119 | this.createTvUser(_userTvDTO, member); | 122 | // 创建大屏账户 |
123 | UserTvDTO tvUser = this.createTvUser(userTv, memberDTO.getId(), memberDTO.getCode()); | ||
124 | return tvUser; | ||
125 | |||
126 | } | ||
127 | |||
128 | throw new EntityNotFoundException(MemberDTO.class,"code",GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
120 | 129 | ||
121 | return true; | ||
122 | } | 130 | } |
123 | 131 | ||
124 | throw new BadRequestException(GlobeExceptionMsg.ENTITY_ALREADY_EXISTS); | 132 | throw new BadRequestException(GlobeExceptionMsg.ENTITY_ALREADY_EXISTS); |
... | @@ -126,14 +134,14 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -126,14 +134,14 @@ public class UserOperationServiceImpl implements UserOperationService { |
126 | } | 134 | } |
127 | 135 | ||
128 | /** | 136 | /** |
129 | * | 137 | * 创建小屏账户同时创建会员 |
130 | * @param resources | 138 | * @param resources |
131 | * @return | 139 | * @return UserWeixinDTO |
132 | */ | 140 | */ |
133 | @Override | 141 | @Override |
134 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 142 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
135 | @AsyncMqSend | 143 | @AsyncMqSend |
136 | public UserWeixinDTO createWeixinUserAndCreateMember(UserWeixin resources) { | 144 | public UserWeixinDTO createWeixinUserAndMember(UserWeixin resources) { |
137 | 145 | ||
138 | String appId = resources.getAppid(); | 146 | String appId = resources.getAppid(); |
139 | String openId = resources.getOpenid(); | 147 | String openId = resources.getOpenid(); |
... | @@ -141,59 +149,56 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -141,59 +149,56 @@ public class UserOperationServiceImpl implements UserOperationService { |
141 | 149 | ||
142 | // 检查小屏账户是否存在 | 150 | // 检查小屏账户是否存在 |
143 | UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); | 151 | UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); |
144 | if (Objects.nonNull(userWeixinDTO.getId())) | 152 | if (Objects.nonNull(userWeixinDTO.getId())) { |
145 | return userWeixinDTO; | 153 | log.error("createWeixinUserAndMember ==>> result ==>> [{}]", userWeixinDTO); |
154 | throw new BadRequestException(GlobeExceptionMsg.OPERATION_FORBID + "==>> " + GlobeExceptionMsg.ENTITY_ALREADY_EXISTS); | ||
155 | } | ||
146 | 156 | ||
147 | // 当前用户的任意微信app,因为同一unionId的会员是唯一的 | 157 | // 当前用户的任意微信app,因为同一unionId的会员是唯一的 |
148 | UserWeixinDTO userWeixinDTO1 = this.findFirstByUnionId(unionId); | 158 | UserWeixinDTO _userWeixinDTO = this.findFirstByUnionId(unionId); |
159 | if (Objects.nonNull(_userWeixinDTO.getId())) { | ||
149 | 160 | ||
150 | UserWeixinDTO _userWeixinDTO = new UserWeixinDTO(); | 161 | Assert.notNull(_userWeixinDTO.getMemberId(),GlobeExceptionMsg.MEMBER_ID_IS_NULL); |
151 | Member member = null; | ||
152 | 162 | ||
153 | if (Objects.nonNull(userWeixinDTO1.getId())) { | 163 | // 小屏会员 |
164 | MemberDTO memberDTO = this.findMemberById(_userWeixinDTO.getMemberId()); | ||
165 | if (Objects.nonNull(memberDTO)) { | ||
166 | resources.setMemberId(_userWeixinDTO.getMemberId()); | ||
167 | UserWeixin userWeixin = UserWeixinBuilder.build(resources); | ||
168 | return this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode()); | ||
169 | } | ||
154 | 170 | ||
155 | Long memberId = userWeixinDTO1.getMemberId(); | 171 | throw new EntityNotFoundException(MemberDTO.class,"code",GlobeExceptionMsg.MEMBER_CODE_IS_NULL); |
156 | resources.setMemberId(memberId); | ||
157 | BeanUtils.copyProperties(resources,_userWeixinDTO); | ||
158 | 172 | ||
159 | } else { | 173 | } else { |
160 | // x_member | 174 | |
161 | member = | 175 | // 新建会员 |
176 | Member _member = | ||
162 | MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN, | 177 | MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN, |
163 | null, "", 0); | 178 | null, "", 0); |
179 | MemberDTO memberDTO = this.createMember(_member); | ||
164 | 180 | ||
165 | BeanUtils.copyProperties(resources,_userWeixinDTO); | 181 | if (Objects.nonNull(memberDTO)) { |
166 | } | 182 | UserWeixin userWeixin = UserWeixinBuilder.build(resources); |
183 | return this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode()); | ||
184 | } | ||
167 | 185 | ||
168 | this.createWeixinUser(_userWeixinDTO,member); | 186 | throw new EntityNotFoundException(MemberDTO.class,"code",GlobeExceptionMsg.MEMBER_CODE_IS_NULL); |
169 | 187 | ||
170 | return null; | 188 | } |
171 | } | ||
172 | 189 | ||
190 | } | ||
173 | 191 | ||
192 | /** | ||
193 | * 服务号登录 | ||
194 | * @param resources | ||
195 | * @return | ||
196 | */ | ||
174 | @Override | 197 | @Override |
175 | public Object serviceLogin(WeiXinUserBean resources) { | 198 | public UserWeixinDTO serviceLogin(UserWeixin resources) { |
176 | String unionId = resources.getUnionid(); | ||
177 | String appId = resources.getAppid(); | ||
178 | String openId = resources.getOpenid(); | ||
179 | 199 | ||
180 | // 小屏账户 | 200 | // 创建小屏账户同时创建会员 |
181 | UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); | 201 | UserWeixinDTO userWeixinDTO = this.createWeixinUserAndMember(resources); |
182 | |||
183 | if (Objects.isNull(userWeixinDTO.getId())) { | ||
184 | |||
185 | // member | ||
186 | Member member = | ||
187 | MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN, | ||
188 | resources.getHeadimgurl(), resources.getNikename(), 0); | ||
189 | |||
190 | userWeixinDTO = new UserWeixinDTO(); | ||
191 | BeanUtils.copyProperties(resources,userWeixinDTO); | ||
192 | |||
193 | UserWeixin weixinUser = this.createWeixinUser(userWeixinDTO, member); | ||
194 | userWeixinDTO.setId(weixinUser.getId()); | ||
195 | |||
196 | } | ||
197 | 202 | ||
198 | // 为了保证返回的同一用户 | 203 | // 为了保证返回的同一用户 |
199 | UserWeixinDTO userWeixinDTO_0 = this.getFirstId(userWeixinDTO); | 204 | UserWeixinDTO userWeixinDTO_0 = this.getFirstId(userWeixinDTO); |
... | @@ -207,28 +212,14 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -207,28 +212,14 @@ public class UserOperationServiceImpl implements UserOperationService { |
207 | */ | 212 | */ |
208 | @Override | 213 | @Override |
209 | @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false, rollbackFor = Exception.class) | 214 | @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false, rollbackFor = Exception.class) |
210 | public UserWeixinDTO appletLogin(WeiXinUserBean resources) { | 215 | public UserWeixinDTO appletLogin(UserWeixin resources) { |
211 | String unionId = resources.getUnionid(); | ||
212 | String appId = resources.getAppid(); | ||
213 | String openId = resources.getOpenid(); | ||
214 | 216 | ||
215 | // 小屏账户 | 217 | // 创建小屏账户同时创建会员 |
216 | UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); | 218 | UserWeixinDTO userWeixinDTO = this.createWeixinUserAndMember(resources); |
217 | 219 | ||
218 | if (Objects.isNull(userWeixinDTO.getId())) { | 220 | // 为了保证返回的同一用户 |
219 | // member | 221 | UserWeixinDTO userWeixinDTO_0 = this.getFirstId(userWeixinDTO); |
220 | Member member = | 222 | return userWeixinDTO_0; |
221 | MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN, | ||
222 | resources.getHeadimgurl(), resources.getNikename(), 0); | ||
223 | |||
224 | userWeixinDTO = new UserWeixinDTO(); | ||
225 | BeanUtils.copyProperties(resources, userWeixinDTO); | ||
226 | |||
227 | UserWeixin weixinUser = this.createWeixinUser(userWeixinDTO, member); | ||
228 | userWeixinDTO.setId(weixinUser.getId()); | ||
229 | } | ||
230 | |||
231 | return this.getFirstId(userWeixinDTO); | ||
232 | } | 223 | } |
233 | 224 | ||
234 | /** | 225 | /** |
... | @@ -246,8 +237,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -246,8 +237,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
246 | @Override | 237 | @Override |
247 | public boolean subscribe(SubscribeBean resources) { | 238 | public boolean subscribe(SubscribeBean resources) { |
248 | String unionId = resources.getUnionid(); | 239 | String unionId = resources.getUnionid(); |
249 | String appId = resources.getAppId(); | 240 | String appId = resources.getAppid(); |
250 | String openId = resources.getOpenId(); | 241 | String openId = resources.getOpenid(); |
251 | String nickname = resources.getNickname(); | 242 | String nickname = resources.getNickname(); |
252 | String headImgUrl = resources.getHeadimgurl(); | 243 | String headImgUrl = resources.getHeadimgurl(); |
253 | 244 | ||
... | @@ -256,20 +247,15 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -256,20 +247,15 @@ public class UserOperationServiceImpl implements UserOperationService { |
256 | 247 | ||
257 | if (Objects.isNull(userWeixinDTO.getId())) { | 248 | if (Objects.isNull(userWeixinDTO.getId())) { |
258 | 249 | ||
259 | // member | 250 | UserWeixin userWeixin = new UserWeixin(); |
260 | Member member = | 251 | BeanUtils.copyProperties(resources,userWeixin); |
261 | MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN, | 252 | // 创建小屏账户同时创建会员 |
262 | resources.getHeadimgurl(), resources.getNikename(), 1); | 253 | this.createWeixinUserAndMember(userWeixin); |
263 | |||
264 | UserWeixinDTO _userWeixinDTO = new UserWeixinDTO(); | ||
265 | BeanUtils.copyProperties(resources,_userWeixinDTO); | ||
266 | |||
267 | this.createWeixinUser(_userWeixinDTO,member); | ||
268 | 254 | ||
269 | } else { | 255 | } else { |
270 | 256 | ||
271 | // 修改账 status =1 , 会员 vip = 1 | 257 | // 修改微信账户关注状态 |
272 | this.doUpdateUserWeiXinAndMember(userWeixinDTO,appId,openId,headImgUrl,nickname); | 258 | this.doUpdateUserWeiXinStatus(userWeixinDTO,SUBSCRIBE_STATUS); |
273 | 259 | ||
274 | } | 260 | } |
275 | 261 | ||
... | @@ -280,7 +266,21 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -280,7 +266,21 @@ public class UserOperationServiceImpl implements UserOperationService { |
280 | // 小屏会员 | 266 | // 小屏会员 |
281 | MemberDTO memberDTO = this.findMemberByAppIdAndOpenId(appId,openId); | 267 | MemberDTO memberDTO = this.findMemberByAppIdAndOpenId(appId,openId); |
282 | 268 | ||
283 | // 账户 | 269 | if (memberDTO != null) { |
270 | |||
271 | if (StringUtils.isNotBlank(headImgUrl) && StringUtils.isNotBlank(nickname)) { | ||
272 | memberDTO.setAvatarUrl(headImgUrl); | ||
273 | memberDTO.setNickname(nickname); | ||
274 | } | ||
275 | |||
276 | Integer vip = memberDTO.getVip(); | ||
277 | // 未购买付费会员 | ||
278 | if (Objects.isNull(vip) || vip < 1) { | ||
279 | memberDTO.setVip(1); | ||
280 | } | ||
281 | } | ||
282 | |||
283 | // 大屏账户 | ||
284 | String platformAccount = iptvUserInfo.getString("platformAccount"); | 284 | String platformAccount = iptvUserInfo.getString("platformAccount"); |
285 | 285 | ||
286 | this.bind(memberDTO,platformAccount); | 286 | this.bind(memberDTO,platformAccount); |
... | @@ -299,8 +299,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -299,8 +299,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
299 | @Override | 299 | @Override |
300 | public boolean unsubscribe(SubscribeBean resources) { | 300 | public boolean unsubscribe(SubscribeBean resources) { |
301 | 301 | ||
302 | String appId = resources.getAppId(); | 302 | String appId = resources.getAppid(); |
303 | String openId = resources.getOpenId(); | 303 | String openId = resources.getOpenid(); |
304 | 304 | ||
305 | // 修改关注状态 0:未关注 | 305 | // 修改关注状态 0:未关注 |
306 | UserWeixinDTO userWeixinDTO = this.doUpdateUserWeiXinStatus(appId, openId, UNSUBSCRIBE_STATUS); | 306 | UserWeixinDTO userWeixinDTO = this.doUpdateUserWeiXinStatus(appId, openId, UNSUBSCRIBE_STATUS); |
... | @@ -426,9 +426,6 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -426,9 +426,6 @@ public class UserOperationServiceImpl implements UserOperationService { |
426 | @AsyncMqSend | 426 | @AsyncMqSend |
427 | public boolean deleteCollection(String content) { | 427 | public boolean deleteCollection(String content) { |
428 | try { | 428 | try { |
429 | |||
430 | log.info("receive UserCollection delete message, content [{}]", content); | ||
431 | |||
432 | JSONObject jsonObject = JSONObject.parseObject(content); | 429 | JSONObject jsonObject = JSONObject.parseObject(content); |
433 | String platformAccount = jsonObject.getString("platformAccount"); | 430 | String platformAccount = jsonObject.getString("platformAccount"); |
434 | String data = jsonObject.getString("data"); | 431 | String data = jsonObject.getString("data"); |
... | @@ -512,7 +509,6 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -512,7 +509,6 @@ public class UserOperationServiceImpl implements UserOperationService { |
512 | if (userCollectionMqList == null || userCollectionMqList.isEmpty()) | 509 | if (userCollectionMqList == null || userCollectionMqList.isEmpty()) |
513 | return false; | 510 | return false; |
514 | 511 | ||
515 | |||
516 | Map<Long, List<UserCollectionMq>> collect = userCollectionMqList.stream().collect(Collectors.groupingBy(UserCollectionMq::getUserCollectionId)); | 512 | Map<Long, List<UserCollectionMq>> collect = userCollectionMqList.stream().collect(Collectors.groupingBy(UserCollectionMq::getUserCollectionId)); |
517 | 513 | ||
518 | for (Map.Entry<Long, List<UserCollectionMq>> entry : collect.entrySet()) { | 514 | for (Map.Entry<Long, List<UserCollectionMq>> entry : collect.entrySet()) { |
... | @@ -568,17 +564,16 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -568,17 +564,16 @@ public class UserOperationServiceImpl implements UserOperationService { |
568 | public boolean appletBind(BindBean resources) { | 564 | public boolean appletBind(BindBean resources) { |
569 | 565 | ||
570 | Long id = resources.getId(); | 566 | Long id = resources.getId(); |
571 | Long platformUserId = resources.getPlatformUserId(); | ||
572 | String unionid = resources.getUnionid(); | 567 | String unionid = resources.getUnionid(); |
568 | |||
573 | String platformAccount = resources.getPlatformAccount(); | 569 | String platformAccount = resources.getPlatformAccount(); |
574 | 570 | ||
575 | // 大屏账户 | 571 | // 大屏账户 |
576 | UserTvDTO userTvDTO = this.findUserIptvById(platformUserId); | 572 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
577 | |||
578 | // 账户是否存在 | 573 | // 账户是否存在 |
579 | if (Objects.isNull(userTvDTO.getId())){ | 574 | if (Objects.isNull(userTvDTO.getId())){ |
580 | log.error("Param ==> platformUserId ==> [{}]",platformUserId); | 575 | log.error("appletBind ==> platformAccount ==> [{}]",platformAccount); |
581 | throw new EntityNotFoundException(UserTvDTO.class,"id","大屏账户不存在!"); | 576 | throw new EntityNotFoundException(UserTvDTO.class,"id",GlobeExceptionMsg.IPTV_IS_NULL); |
582 | } | 577 | } |
583 | 578 | ||
584 | UserWeixinDTO userWeixinDTO = null; | 579 | UserWeixinDTO userWeixinDTO = null; |
... | @@ -591,42 +586,31 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -591,42 +586,31 @@ public class UserOperationServiceImpl implements UserOperationService { |
591 | 586 | ||
592 | // 账户是否存在 | 587 | // 账户是否存在 |
593 | if (Objects.isNull(userWeixinDTO.getId())) { | 588 | if (Objects.isNull(userWeixinDTO.getId())) { |
594 | log.error("param ==> id ==> [{}]",id); | 589 | log.error("appletBind ==> weixinId ==> [{}]",id); |
595 | throw new EntityNotFoundException(UserWeixinDTO.class, "id", userWeixinDTO.getId().toString()); | 590 | throw new EntityNotFoundException(UserWeixinDTO.class, "id", id.toString()); |
596 | } | 591 | } |
597 | 592 | ||
598 | // 会员 | 593 | // 会员 |
599 | Long memberId = userWeixinDTO.getMemberId(); | 594 | Long memberId = userWeixinDTO.getMemberId(); |
600 | if (Objects.isNull(memberId)) { | 595 | if (Objects.isNull(memberId)) { |
601 | log.error("param ==> memberId ==> [{}]",id); | 596 | log.error("appletBind ==> memberId ==> [{}]",memberId); |
602 | throw new EntityNotFoundException(UserWeixinDTO.class, "id", id.toString()); | 597 | throw new EntityNotFoundException(UserWeixinDTO.class, "memberId", memberId.toString()); |
603 | } | 598 | } |
604 | 599 | ||
605 | MemberDTO memberDTO = this.findMemberById(memberId); | 600 | MemberDTO memberDTO = this.findMemberById(memberId); |
606 | if (Objects.isNull(memberId)) { | 601 | // 主账户会员 |
607 | log.error("param ==> memberId ==> [{}]",id); | 602 | String code = memberDTO.getCode(); |
608 | throw new EntityNotFoundException(MemberDTO.class, "id", memberId.toString()); | ||
609 | } | ||
610 | 603 | ||
604 | // 更新大屏信息,同步大屏信息时使用 | ||
605 | userTvDTO.setMemberCode(code); | ||
611 | // 主账户 | 606 | // 主账户 |
612 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | 607 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); |
613 | 608 | ||
614 | if (StringUtils.isBlank(priorityMemberCode)) { | 609 | if (StringUtils.isBlank(priorityMemberCode)) { |
615 | // 主账户会员 | ||
616 | String code = memberDTO.getCode(); | ||
617 | // 设置主账号 | 610 | // 设置主账号 |
618 | userTvDTO.setPriorityMemberCode(code); | 611 | userTvDTO.setPriorityMemberCode(code); |
619 | } | 612 | } |
620 | 613 | ||
621 | // 更新小屏账户更新时间,epg需要根据修改时间来让绑定的二维码消失 | ||
622 | this.doUpdateUserWeiXinUpdateTime(userWeixinDTO); | ||
623 | |||
624 | |||
625 | // 更新大屏信息,同步大屏信息时使用 | ||
626 | userTvDTO.setMemberCode(memberDTO.getCode()); | ||
627 | this.doUpdateUserTv(userTvDTO); | ||
628 | |||
629 | |||
630 | String platform = userTvDTO.getPlatform(); | 614 | String platform = userTvDTO.getPlatform(); |
631 | // 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通 | 615 | // 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通 |
632 | Integer bindIptvPlatformType = 0; | 616 | Integer bindIptvPlatformType = 0; |
... | @@ -646,8 +630,12 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -646,8 +630,12 @@ public class UserOperationServiceImpl implements UserOperationService { |
646 | memberDTO.setBindIptvTime(LocalDateTime.now()); | 630 | memberDTO.setBindIptvTime(LocalDateTime.now()); |
647 | memberDTO.setBindIptvPlatformType(bindIptvPlatformType); | 631 | memberDTO.setBindIptvPlatformType(bindIptvPlatformType); |
648 | memberDTO.setPlatformAccount(platformAccount); | 632 | memberDTO.setPlatformAccount(platformAccount); |
633 | |||
634 | // 更新大屏账户 | ||
635 | this.doUpdateUserTv(userTvDTO); | ||
649 | // 修改会员信息 | 636 | // 修改会员信息 |
650 | this.doUpdateMemberByMemberDTO(memberDTO); | 637 | this.doUpdateMemberByMemberDTO(memberDTO); |
638 | |||
651 | return true; | 639 | return true; |
652 | } | 640 | } |
653 | 641 | ||
... | @@ -690,7 +678,7 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -690,7 +678,7 @@ public class UserOperationServiceImpl implements UserOperationService { |
690 | // 大屏账户 | 678 | // 大屏账户 |
691 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | 679 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
692 | if (Objects.isNull(userTvDTO)) { | 680 | if (Objects.isNull(userTvDTO)) { |
693 | throw new BadRequestException("大屏信息不存在!"); | 681 | throw new BadRequestException(GlobeExceptionMsg.IPTV_IS_NULL); |
694 | } | 682 | } |
695 | 683 | ||
696 | // mq同步数据时使用 | 684 | // mq同步数据时使用 |
... | @@ -821,28 +809,6 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -821,28 +809,6 @@ public class UserOperationServiceImpl implements UserOperationService { |
821 | } | 809 | } |
822 | 810 | ||
823 | /** | 811 | /** |
824 | * | ||
825 | * @param userWeixinDTO | ||
826 | * @param appId | ||
827 | * @param openId | ||
828 | */ | ||
829 | private void doUpdateUserWeiXinAndMember(UserWeixinDTO userWeixinDTO,String appId,String openId,String headImgUrl,String nickName) { | ||
830 | |||
831 | // 修改微信账户关注状态 | ||
832 | this.doUpdateUserWeiXinStatus(userWeixinDTO,SUBSCRIBE_STATUS); | ||
833 | |||
834 | // 小屏会员 | ||
835 | MemberDTO memberDTO_0 = this.findMemberByAppIdAndOpenId(appId,openId); | ||
836 | |||
837 | if (StringUtils.isNotBlank(headImgUrl) && StringUtils.isNotBlank(nickName)) { | ||
838 | memberDTO_0.setAvatarUrl(headImgUrl); | ||
839 | memberDTO_0.setNickname(nickName); | ||
840 | } | ||
841 | |||
842 | this.doUpdateMemberVip(memberDTO_0,1); | ||
843 | } | ||
844 | |||
845 | /** | ||
846 | * 获取小屏会员 | 812 | * 获取小屏会员 |
847 | * @param appId | 813 | * @param appId |
848 | * @param openId | 814 | * @param openId |
... | @@ -939,20 +905,20 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -939,20 +905,20 @@ public class UserOperationServiceImpl implements UserOperationService { |
939 | * 修改会员 | 905 | * 修改会员 |
940 | * @param memberDTO | 906 | * @param memberDTO |
941 | */ | 907 | */ |
942 | private void doUpdateMemberByMemberDTO(MemberDTO memberDTO){ | 908 | private MemberDTO doUpdateMemberByMemberDTO(MemberDTO memberDTO){ |
943 | Member member = new Member(); | 909 | Member member = new Member(); |
944 | BeanUtils.copyProperties(memberDTO,member); | 910 | BeanUtils.copyProperties(memberDTO,member); |
945 | member.setUpdateTime(LocalDateTime.now()); | 911 | member.setUpdateTime(LocalDateTime.now()); |
946 | log.info("doUpdateMemberByMemberDTO=====?>>member ==>> [{}]",member); | 912 | log.info("doUpdateMemberByMemberDTO=====?>>member ==>> [{}]",member); |
947 | this.doUpdateMember(member); | 913 | return this.doUpdateMember(member); |
948 | } | 914 | } |
949 | 915 | ||
950 | /** | 916 | /** |
951 | * 修改会员 | 917 | * 修改会员 |
952 | * @param member | 918 | * @param member |
953 | */ | 919 | */ |
954 | private void doUpdateMember(Member member){ | 920 | private MemberDTO doUpdateMember(Member member){ |
955 | this.memberService.update(member); | 921 | return this.memberService.update(member); |
956 | } | 922 | } |
957 | 923 | ||
958 | 924 | ||
... | @@ -1062,46 +1028,43 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1062,46 +1028,43 @@ public class UserOperationServiceImpl implements UserOperationService { |
1062 | * @param member | 1028 | * @param member |
1063 | * @return | 1029 | * @return |
1064 | */ | 1030 | */ |
1065 | private Long createMember(Member member){ | 1031 | private MemberDTO createMember(Member member){ |
1066 | return this.memberService.create(member).getId(); | 1032 | return this.memberService.create(member); |
1067 | } | 1033 | } |
1068 | 1034 | ||
1069 | /** | 1035 | /** |
1070 | * | 1036 | * |
1071 | * @param resources | 1037 | * @param resources |
1072 | * @param member | 1038 | * @param memberId |
1073 | * @return | 1039 | * @return |
1074 | */ | 1040 | */ |
1075 | private UserTv createTvUser(UserTvDTO resources,Member member){ | 1041 | private UserTvDTO createTvUser(UserTv resources, Long memberId, String memberCode){ |
1076 | 1042 | ||
1077 | if (member != null) { | 1043 | resources.setMemberId(memberId); |
1078 | Long memberId = this.createMember(member); | 1044 | resources.setMemberCode(memberCode); |
1079 | resources.setMemberId(memberId); | 1045 | UserTv userTv = this.userTvService.create(resources); |
1080 | } | ||
1081 | 1046 | ||
1082 | UserTv _userTv = new UserTv(); | 1047 | UserTvDTO userTvDTO = new UserTvDTO(); |
1083 | BeanUtils.copyProperties(resources,_userTv); | 1048 | BeanUtils.copyProperties(userTv,userTvDTO); |
1084 | return this.userTvService.create(_userTv); | 1049 | return userTvDTO; |
1085 | } | 1050 | } |
1086 | 1051 | ||
1087 | /** | 1052 | /** |
1088 | * | 1053 | * |
1089 | * @param userWeixinDTO | 1054 | * @param resource |
1090 | * @param member | 1055 | * @param memberId |
1056 | * @param memberCode | ||
1091 | * @return | 1057 | * @return |
1092 | */ | 1058 | */ |
1093 | private UserWeixin createWeixinUser(UserWeixinDTO userWeixinDTO,Member member){ | 1059 | private UserWeixinDTO createWeixinUser(UserWeixin resource, Long memberId, String memberCode){ |
1094 | 1060 | ||
1095 | if (member != null) { | 1061 | resource.setMemberId(memberId); |
1096 | // 创建会员 | 1062 | resource.setMemberCode(memberCode); |
1097 | Long memberId = this.createMember(member); | 1063 | UserWeixin userWeixin = this.userWeixinService.create(resource); |
1098 | userWeixinDTO.setMemberId(memberId); | ||
1099 | } | ||
1100 | |||
1101 | UserWeixin _userWeixin = new UserWeixin(); | ||
1102 | BeanUtils.copyProperties(userWeixinDTO,_userWeixin); | ||
1103 | 1064 | ||
1104 | return this.userWeixinService.create(_userWeixin); | 1065 | UserWeixinDTO userWeixinDTO = new UserWeixinDTO(); |
1066 | BeanUtils.copyProperties(userWeixin,userWeixinDTO); | ||
1067 | return userWeixinDTO; | ||
1105 | } | 1068 | } |
1106 | 1069 | ||
1107 | } | 1070 | } | ... | ... |
1 | package com.topdraw.business.process.service.impl.member; | ||
2 | |||
3 | import com.topdraw.aspect.AsyncMqSend; | ||
4 | import com.topdraw.business.module.member.address.domain.MemberAddress; | ||
5 | import com.topdraw.business.module.member.address.service.MemberAddressService; | ||
6 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | ||
7 | import com.topdraw.business.process.service.member.MemberAddressOperationService; | ||
8 | import lombok.extern.slf4j.Slf4j; | ||
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 XiangHan | ||
16 | * @date 2021-10-22 | ||
17 | */ | ||
18 | @Service | ||
19 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
20 | @Slf4j | ||
21 | public class MemberAddressOperationServiceImpl implements MemberAddressOperationService { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberAddressService memberAddressService; | ||
25 | |||
26 | @Override | ||
27 | public MemberAddressDTO findById(Long id) { | ||
28 | return this.memberAddressService.findById(id); | ||
29 | } | ||
30 | |||
31 | @Override | ||
32 | @Transactional(rollbackFor = Exception.class) | ||
33 | @AsyncMqSend | ||
34 | public MemberAddressDTO create(MemberAddress resources) { | ||
35 | log.info("MemberAddressOperationServiceImpl ==>> create ==>> param ==>> [{}]",resources); | ||
36 | return this.memberAddressService.create(resources); | ||
37 | } | ||
38 | |||
39 | @Override | ||
40 | @Transactional(rollbackFor = Exception.class) | ||
41 | @AsyncMqSend | ||
42 | public MemberAddressDTO update(MemberAddress resources) { | ||
43 | log.info("MemberAddressOperationServiceImpl ==>> update ==>> param ==>> [{}]",resources); | ||
44 | |||
45 | return this.memberAddressService.update(resources); | ||
46 | } | ||
47 | |||
48 | @Override | ||
49 | @Transactional(rollbackFor = Exception.class) | ||
50 | @AsyncMqSend | ||
51 | public void delete(Long id) { | ||
52 | this.memberAddressService.delete(id); | ||
53 | } | ||
54 | |||
55 | } |
1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl.member; |
2 | 2 | ||
3 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
4 | import com.topdraw.business.module.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
5 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
5 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 6 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 7 | 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.MemberService; |
... | @@ -12,12 +13,12 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ... | @@ -12,12 +13,12 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
12 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | 13 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
13 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 14 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
14 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | 15 | import com.topdraw.business.process.domian.weixin.BuyVipBean; |
15 | import com.topdraw.business.process.service.MemberOperationService; | 16 | import com.topdraw.business.process.service.member.MemberOperationService; |
17 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | ||
16 | import com.topdraw.exception.EntityNotFoundException; | 18 | import com.topdraw.exception.EntityNotFoundException; |
17 | import org.springframework.beans.BeanUtils; | 19 | import org.springframework.beans.BeanUtils; |
18 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
19 | import org.springframework.cache.annotation.CacheConfig; | 21 | import org.springframework.cache.annotation.CacheConfig; |
20 | import org.springframework.cache.annotation.CacheEvict; | ||
21 | import org.springframework.cache.annotation.CachePut; | 22 | import org.springframework.cache.annotation.CachePut; |
22 | import org.springframework.cache.annotation.Cacheable; | 23 | import org.springframework.cache.annotation.Cacheable; |
23 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 24 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
... | @@ -35,7 +36,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -35,7 +36,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
35 | @Autowired | 36 | @Autowired |
36 | private MemberService memberService; | 37 | private MemberService memberService; |
37 | @Autowired | 38 | @Autowired |
38 | private MemberProfileService memberProfileService; | 39 | private MemberProfileOperationService memberProfileOperationService; |
39 | @Autowired | 40 | @Autowired |
40 | private MemberVipHistoryService memberVipHistoryService; | 41 | private MemberVipHistoryService memberVipHistoryService; |
41 | @Autowired | 42 | @Autowired |
... | @@ -103,6 +104,11 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -103,6 +104,11 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
103 | return member; | 104 | return member; |
104 | } | 105 | } |
105 | 106 | ||
107 | @Override | ||
108 | public MemberDTO findByCode(String code) { | ||
109 | return this.memberService.findByCode(code); | ||
110 | } | ||
111 | |||
106 | 112 | ||
107 | private UserWeixinDTO findWeiXinById(Long id) { | 113 | private UserWeixinDTO findWeiXinById(Long id) { |
108 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id); | 114 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id); |
... | @@ -178,18 +184,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -178,18 +184,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
178 | MemberProfileDTO memberProfileDTO = new MemberProfileDTO(); | 184 | MemberProfileDTO memberProfileDTO = new MemberProfileDTO(); |
179 | BeanUtils.copyProperties(memberProfileDTO_0,memberProfileDTO); | 185 | BeanUtils.copyProperties(memberProfileDTO_0,memberProfileDTO); |
180 | 186 | ||
181 | /*// 真实姓名 | ||
182 | String realname = memberProfileDTO.getRealname(); | ||
183 | if (StringUtils.isNotBlank(realname)) { | ||
184 | realname = new String(Base64.getEncoder().encode(realname.getBytes(StandardCharsets.UTF_8))); | ||
185 | } | ||
186 | |||
187 | // 昵称 | ||
188 | String nickname = memberDTO.getNickname(); | ||
189 | if (StringUtils.isNotBlank(nickname)) { | ||
190 | nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); | ||
191 | }*/ | ||
192 | |||
193 | // vip | 187 | // vip |
194 | Integer vip = memberDTO.getVip(); | 188 | Integer vip = memberDTO.getVip(); |
195 | // 过期时间 | 189 | // 过期时间 |
... | @@ -217,16 +211,12 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -217,16 +211,12 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
217 | 211 | ||
218 | // 过期时间 | 212 | // 过期时间 |
219 | memberProfileDTO.setVipExpireTime(timeLong); | 213 | memberProfileDTO.setVipExpireTime(timeLong); |
220 | // 真实姓名 | ||
221 | // memberProfileDTO.setRealname(realname); | ||
222 | // 头像 | 214 | // 头像 |
223 | memberProfileDTO.setAvatarUrl(memberDTO.getAvatarUrl()); | 215 | memberProfileDTO.setAvatarUrl(memberDTO.getAvatarUrl()); |
224 | // 生日 | 216 | // 生日 |
225 | memberProfileDTO.setBirthday(memberDTO.getBirthday()); | 217 | memberProfileDTO.setBirthday(memberDTO.getBirthday()); |
226 | // 性别 | 218 | // 性别 |
227 | memberProfileDTO.setGender(memberDTO.getGender()); | 219 | memberProfileDTO.setGender(memberDTO.getGender()); |
228 | // 昵称 | ||
229 | // memberProfileDTO.setNickname(nickname); | ||
230 | // 会员id | 220 | // 会员id |
231 | memberProfileDTO.setMemberId(memberDTO.getId()); | 221 | memberProfileDTO.setMemberId(memberDTO.getId()); |
232 | // vip | 222 | // vip |
... | @@ -285,6 +275,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -285,6 +275,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
285 | * @return | 275 | * @return |
286 | */ | 276 | */ |
287 | private MemberProfileDTO findMemberProfileByMemberId(Long memberId) { | 277 | private MemberProfileDTO findMemberProfileByMemberId(Long memberId) { |
288 | return this.memberProfileService.findByMemberId(memberId); | 278 | return this.memberProfileOperationService.findByMemberId(memberId); |
289 | } | 279 | } |
290 | } | 280 | } | ... | ... |
1 | package com.topdraw.business.process.service.impl.member; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
5 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | ||
6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ||
7 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | ||
8 | import org.springframework.beans.factory.annotation.Autowired; | ||
9 | import org.springframework.stereotype.Service; | ||
10 | |||
11 | /** | ||
12 | * @author : | ||
13 | * @description: | ||
14 | * @function : | ||
15 | * @date :Created in 2022/3/20 17:34 | ||
16 | * @version: : | ||
17 | * @modified By: | ||
18 | * @since : modified in 2022/3/20 17:34 | ||
19 | */ | ||
20 | @Service | ||
21 | public class MemberProfileOperationServiceImpl implements MemberProfileOperationService { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberProfileService memberProfileService; | ||
25 | |||
26 | @Override | ||
27 | public MemberProfileDTO findById(Long id) { | ||
28 | return this.memberProfileService.findById(id); | ||
29 | } | ||
30 | |||
31 | @Override | ||
32 | public MemberProfile create(MemberProfile resources) { | ||
33 | return this.memberProfileService.create(resources); | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | public MemberProfile createDefault(MemberProfile resources) { | ||
38 | return this.memberProfileService.createDefault(resources); | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | public MemberProfile createDefault(Member resources) { | ||
43 | return this.memberProfileService.createDefault(resources); | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | public MemberProfile createDefaultByMemberId(Long resources) { | ||
48 | return this.memberProfileService.createDefaultByMemberId(resources); | ||
49 | } | ||
50 | |||
51 | @Override | ||
52 | public MemberProfileDTO update(MemberProfile resources) { | ||
53 | return this.memberProfileService.update(resources); | ||
54 | } | ||
55 | |||
56 | @Override | ||
57 | public void delete(Long id) { | ||
58 | this.memberProfileService.delete(id); | ||
59 | } | ||
60 | |||
61 | @Override | ||
62 | public MemberProfileDTO findByMemberId(Long memberId) { | ||
63 | return this.memberProfileService.findByMemberId(memberId); | ||
64 | } | ||
65 | |||
66 | @Override | ||
67 | public MemberProfileDTO findByMemberCode(String memberCode) { | ||
68 | return this.memberProfileService.findByMemberCode(memberCode); | ||
69 | } | ||
70 | |||
71 | @Override | ||
72 | public void updateMemberProfileAndMember(MemberProfile resources) { | ||
73 | this.memberProfileService.updateMemberProfileAndMember(resources); | ||
74 | } | ||
75 | } |
1 | package com.topdraw.business.process.service.impl.member; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; | ||
5 | import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService; | ||
6 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; | ||
7 | import com.topdraw.business.process.service.member.MemberRelatedInfoOperationService; | ||
8 | import org.springframework.beans.factory.annotation.Autowired; | ||
9 | import org.springframework.stereotype.Service; | ||
10 | |||
11 | /** | ||
12 | * @author : | ||
13 | * @description: | ||
14 | * @function : | ||
15 | * @date :Created in 2022/3/20 18:41 | ||
16 | * @version: : | ||
17 | * @modified By: | ||
18 | * @since : modified in 2022/3/20 18:41 | ||
19 | */ | ||
20 | @Service | ||
21 | public class MemberRelatedInfoOperationServiceImpl implements MemberRelatedInfoOperationService { | ||
22 | |||
23 | @Autowired | ||
24 | private MemberRelatedInfoService memberRelatedInfoService; | ||
25 | |||
26 | @Override | ||
27 | public MemberRelatedInfoDTO findById(Long id) { | ||
28 | return this.memberRelatedInfoService.findById(id); | ||
29 | } | ||
30 | |||
31 | @Override | ||
32 | public void create(MemberRelatedInfo resources) { | ||
33 | this.memberRelatedInfoService.create(resources); | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | public void update(MemberRelatedInfo resources) { | ||
38 | this.memberRelatedInfoService.update(resources); | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | public void delete(Long id) { | ||
43 | this.memberRelatedInfoService.delete(id); | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | public MemberRelatedInfo findByIdCard(MemberRelatedInfo resources) { | ||
48 | return this.memberRelatedInfoService.findByIdCard(resources); | ||
49 | } | ||
50 | |||
51 | @Override | ||
52 | public MemberRelatedInfo findByIdCard(String idCard) { | ||
53 | return this.memberRelatedInfoService.findByIdCard(idCard); | ||
54 | } | ||
55 | |||
56 | @Override | ||
57 | public MemberRelatedInfo findByMemberIdAndIdCard(Long memberId, String idCard) { | ||
58 | return this.memberRelatedInfoService.findByMemberIdAndIdCard(memberId, idCard); | ||
59 | } | ||
60 | |||
61 | @Override | ||
62 | public MemberRelatedInfo findByMemberCodeAndIdCard(String memberCode, String idCard) { | ||
63 | return this.memberRelatedInfoService.findByMemberCodeAndIdCard(memberCode, idCard); | ||
64 | } | ||
65 | |||
66 | @Override | ||
67 | public MemberRelatedInfo findByMemberIdAndIdCard(MemberRelatedInfo resources) { | ||
68 | return this.memberRelatedInfoService.findByMemberIdAndIdCard(resources); | ||
69 | } | ||
70 | |||
71 | @Override | ||
72 | public MemberRelatedInfo findByMemberIdAndIdCard(Member member, MemberRelatedInfo resources) { | ||
73 | return this.memberRelatedInfoService.findByMemberIdAndIdCard(member, resources); | ||
74 | } | ||
75 | } |
1 | package com.topdraw.business.process.service.member; | ||
2 | |||
3 | import com.topdraw.business.module.member.address.domain.MemberAddress; | ||
4 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | ||
5 | |||
6 | public interface MemberAddressOperationService { | ||
7 | |||
8 | /** | ||
9 | * 根据ID查询 | ||
10 | * @param resources ID | ||
11 | * @return MemberAddressDTO | ||
12 | */ | ||
13 | MemberAddressDTO findById(Long resources); | ||
14 | |||
15 | /** | ||
16 | * 保存会员地址 | ||
17 | * @param resources | ||
18 | */ | ||
19 | MemberAddressDTO create(MemberAddress resources); | ||
20 | |||
21 | /** | ||
22 | * 修改会员地址 | ||
23 | * @param resources | ||
24 | */ | ||
25 | MemberAddressDTO update(MemberAddress resources); | ||
26 | |||
27 | /** | ||
28 | * 通过id删除 | ||
29 | * @param resources | ||
30 | */ | ||
31 | void delete(Long resources); | ||
32 | |||
33 | } |
1 | package com.topdraw.business.process.service; | 1 | package com.topdraw.business.process.service.member; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.domain.Member; | 3 | import com.topdraw.business.module.member.domain.Member; |
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.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
6 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | 7 | import com.topdraw.business.process.domian.weixin.BuyVipBean; |
... | @@ -65,4 +66,10 @@ public interface MemberOperationService { | ... | @@ -65,4 +66,10 @@ public interface MemberOperationService { |
65 | */ | 66 | */ |
66 | MemberDTO update(Member resources); | 67 | MemberDTO update(Member resources); |
67 | 68 | ||
69 | /** | ||
70 | * | ||
71 | * @param code | ||
72 | * @return | ||
73 | */ | ||
74 | MemberDTO findByCode(String code); | ||
68 | } | 75 | } | ... | ... |
1 | package com.topdraw.business.process.service.member; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ||
6 | |||
7 | public interface MemberProfileOperationService { | ||
8 | |||
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 | * 修改 | ||
46 | * @param resources | ||
47 | */ | ||
48 | MemberProfileDTO update(MemberProfile resources); | ||
49 | |||
50 | /** | ||
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 | * 修改会员属性并同步会员信息 | ||
72 | * @param resources | ||
73 | */ | ||
74 | void updateMemberProfileAndMember(MemberProfile resources); | ||
75 | |||
76 | } |
1 | package com.topdraw.business.process.service.member; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; | ||
5 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2021-10-22 | ||
10 | */ | ||
11 | public interface MemberRelatedInfoOperationService { | ||
12 | |||
13 | /** | ||
14 | * 根据ID查询 | ||
15 | * @param id ID | ||
16 | * @return MemberRelatedInfoDTO | ||
17 | */ | ||
18 | MemberRelatedInfoDTO findById(Long id); | ||
19 | |||
20 | /** | ||
21 | * 新增 | ||
22 | * @param resources | ||
23 | */ | ||
24 | void create(MemberRelatedInfo resources); | ||
25 | |||
26 | /** | ||
27 | * 修改 | ||
28 | * @param resources | ||
29 | */ | ||
30 | void update(MemberRelatedInfo resources); | ||
31 | |||
32 | /** | ||
33 | * 删除 | ||
34 | * @param id | ||
35 | */ | ||
36 | void delete(Long id); | ||
37 | |||
38 | /** | ||
39 | * 通过身份证查询 | ||
40 | * @param resources | ||
41 | * @return | ||
42 | */ | ||
43 | MemberRelatedInfo findByIdCard(MemberRelatedInfo resources); | ||
44 | |||
45 | /** | ||
46 | * 通过身份证查询 | ||
47 | * @param idCard 身份证 | ||
48 | * @return | ||
49 | */ | ||
50 | MemberRelatedInfo findByIdCard(String idCard); | ||
51 | |||
52 | /** | ||
53 | * | ||
54 | * @param memberId | ||
55 | * @param idCard | ||
56 | * @return | ||
57 | */ | ||
58 | MemberRelatedInfo findByMemberIdAndIdCard(Long memberId, String idCard); | ||
59 | |||
60 | /** | ||
61 | * | ||
62 | * @param memberCode | ||
63 | * @param idCard | ||
64 | * @return | ||
65 | */ | ||
66 | MemberRelatedInfo findByMemberCodeAndIdCard(String memberCode, String idCard); | ||
67 | |||
68 | /** | ||
69 | * | ||
70 | * @param resources | ||
71 | * @return | ||
72 | */ | ||
73 | MemberRelatedInfo findByMemberIdAndIdCard(MemberRelatedInfo resources); | ||
74 | |||
75 | /** | ||
76 | * | ||
77 | * @param member | ||
78 | * @param resources | ||
79 | * @return | ||
80 | */ | ||
81 | MemberRelatedInfo findByMemberIdAndIdCard(Member member, MemberRelatedInfo resources); | ||
82 | } |
... | @@ -35,8 +35,15 @@ public interface GlobeExceptionMsg { | ... | @@ -35,8 +35,15 @@ public interface GlobeExceptionMsg { |
35 | /**************************************************************/ | 35 | /**************************************************************/ |
36 | 36 | ||
37 | /** 账户管理 **/ | 37 | /** 账户管理 **/ |
38 | |||
39 | /** iptv */ | ||
38 | String IPTV_ID_IS_NULL = "iptvId is null"; | 40 | String IPTV_ID_IS_NULL = "iptvId is null"; |
39 | String IPTV_PLATFORM_ACCOUNT_IS_NULL = "platformAccount is null"; | 41 | String IPTV_PLATFORM_ACCOUNT_IS_NULL = "platformAccount is null"; |
40 | String IPTV_IS_NULL = "iptv is null"; | 42 | String IPTV_IS_NULL = "iptv is null"; |
43 | String VIS_USER_ID_IS_NULL = "visUserId is null"; | ||
41 | 44 | ||
45 | /** 微信 */ | ||
46 | String APP_ID_IS_NULL = "appId is null"; | ||
47 | String OPEN_ID_IS_NULL = "openId is null"; | ||
48 | String UNION_ID_IS_NULL = "unionId is null"; | ||
42 | } | 49 | } | ... | ... |
... | @@ -2,9 +2,12 @@ | ... | @@ -2,9 +2,12 @@ |
2 | spring: | 2 | spring: |
3 | datasource: | 3 | datasource: |
4 | # 测试/演示库url: | 4 | # 测试/演示库url: |
5 | url: jdbc:log4jdbc:mysql://139.196.192.242:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | 5 | # url: jdbc:log4jdbc:mysql://139.196.192.242:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false |
6 | # username: root | ||
7 | # password: Tjlh@2017 | ||
8 | url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
6 | username: root | 9 | username: root |
7 | password: Tjlh@2017 | 10 | password: root |
8 | 11 | ||
9 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | 12 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy |
10 | #Druid | 13 | #Druid | ... | ... |
... | @@ -3,7 +3,7 @@ package com.topdraw.test.business.basicdata.points; | ... | @@ -3,7 +3,7 @@ package com.topdraw.test.business.basicdata.points; |
3 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 3 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
4 | import com.topdraw.business.module.points.detail.domain.PointsDetail; | 4 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
5 | import com.topdraw.business.module.points.detail.service.PointsDetailService; | 5 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
6 | import com.topdraw.business.process.service.MemberOperationService; | 6 | import com.topdraw.business.process.service.member.MemberOperationService; |
7 | import com.topdraw.business.process.domian.TempPoints; | 7 | import com.topdraw.business.process.domian.TempPoints; |
8 | import com.topdraw.BaseTest; | 8 | import com.topdraw.BaseTest; |
9 | import com.topdraw.util.IdWorker; | 9 | import com.topdraw.util.IdWorker; | ... | ... |
... | @@ -5,7 +5,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; | ... | @@ -5,7 +5,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; |
5 | import com.topdraw.business.module.points.detail.domain.PointsDetail; | 5 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
6 | import com.topdraw.business.module.points.detail.service.PointsDetailService; | 6 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
7 | import com.topdraw.business.process.domian.TempPoints; | 7 | import com.topdraw.business.process.domian.TempPoints; |
8 | import com.topdraw.business.process.service.MemberOperationService; | 8 | import com.topdraw.business.process.service.member.MemberOperationService; |
9 | import com.topdraw.util.IdWorker; | 9 | import com.topdraw.util.IdWorker; |
10 | import org.junit.Test; | 10 | import org.junit.Test; |
11 | import org.springframework.beans.BeanUtils; | 11 | import org.springframework.beans.BeanUtils; | ... | ... |
... | @@ -2,10 +2,9 @@ package com.topdraw.test.business.process.service; | ... | @@ -2,10 +2,9 @@ package com.topdraw.test.business.process.service; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | import com.topdraw.business.module.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
5 | import com.topdraw.business.process.service.MemberOperationService; | 5 | import com.topdraw.business.process.service.member.MemberOperationService; |
6 | import com.topdraw.BaseTest; | 6 | import com.topdraw.BaseTest; |
7 | import com.topdraw.util.IdWorker; | 7 | import com.topdraw.util.IdWorker; |
8 | import com.topdraw.util.TimestampUtil; | ||
9 | import org.junit.Test; | 8 | import org.junit.Test; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 10 | ... | ... |
... | @@ -2,6 +2,7 @@ package com.topdraw.test.business.process.service; | ... | @@ -2,6 +2,7 @@ package com.topdraw.test.business.process.service; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | import com.topdraw.BaseTest; | 4 | import com.topdraw.BaseTest; |
5 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
5 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | 6 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; |
6 | import com.topdraw.business.process.service.UserOperationService; | 7 | import com.topdraw.business.process.service.UserOperationService; |
7 | import com.topdraw.module.mq.DataSyncMsg; | 8 | import com.topdraw.module.mq.DataSyncMsg; |
... | @@ -31,8 +32,8 @@ public class UserOperationServiceTest extends BaseTest { | ... | @@ -31,8 +32,8 @@ public class UserOperationServiceTest extends BaseTest { |
31 | 32 | ||
32 | String s = JSON.toJSONString(dataSyncMsg);*/ | 33 | String s = JSON.toJSONString(dataSyncMsg);*/ |
33 | 34 | ||
34 | WeiXinUserBean weiXinUserBean = new WeiXinUserBean(); | 35 | UserWeixin weiXinUserBean = new UserWeixin(); |
35 | weiXinUserBean.setWxAppid("1"); | 36 | /*weiXinUserBean.setWxAppid("1"); |
36 | weiXinUserBean.setWxCode("1"); | 37 | weiXinUserBean.setWxCode("1"); |
37 | weiXinUserBean.setSourceType("1"); | 38 | weiXinUserBean.setSourceType("1"); |
38 | weiXinUserBean.setSourceId("1"); | 39 | weiXinUserBean.setSourceId("1"); |
... | @@ -41,7 +42,7 @@ public class UserOperationServiceTest extends BaseTest { | ... | @@ -41,7 +42,7 @@ public class UserOperationServiceTest extends BaseTest { |
41 | weiXinUserBean.setSourceEntity("1"); | 42 | weiXinUserBean.setSourceEntity("1"); |
42 | weiXinUserBean.setSourceDesc("1"); | 43 | weiXinUserBean.setSourceDesc("1"); |
43 | weiXinUserBean.setSourceUser(1L); | 44 | weiXinUserBean.setSourceUser(1L); |
44 | weiXinUserBean.setUserInfo("1"); | 45 | weiXinUserBean.setUserInfo("1");*/ |
45 | this.taskOperationService.appletLogin(weiXinUserBean); | 46 | this.taskOperationService.appletLogin(weiXinUserBean); |
46 | } | 47 | } |
47 | 48 | ... | ... |
-
Please register or sign in to post a comment