1.会员1.1
Showing
43 changed files
with
417 additions
and
112 deletions
| ... | @@ -45,6 +45,7 @@ public class DataSyncMsg implements Serializable { | ... | @@ -45,6 +45,7 @@ public class DataSyncMsg implements Serializable { |
| 45 | private Integer deviceType; //设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 45 | private Integer deviceType; //设备类型 1:大屏;2:小屏(微信)3.小屏(xx) |
| 46 | @NotNull | 46 | @NotNull |
| 47 | private String appCode; //用户对应的应用code | 47 | private String appCode; //用户对应的应用code |
| 48 | private String memberCode; | ||
| 48 | private Long accountId; // 账号id | 49 | private Long accountId; // 账号id |
| 49 | private Long orderId; | 50 | private Long orderId; |
| 50 | private Long activityId; | 51 | private Long activityId; | ... | ... |
| 1 | package com.topdraw; | 1 | package com.topdraw; |
| 2 | 2 | ||
| 3 | import com.topdraw.config.RedisKeyUtil; | ||
| 4 | import com.topdraw.utils.RedisUtils; | ||
| 3 | import com.topdraw.utils.SpringContextHolder; | 5 | import com.topdraw.utils.SpringContextHolder; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 4 | import org.springframework.boot.SpringApplication; | 7 | import org.springframework.boot.SpringApplication; |
| 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | 8 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
| 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; | ... | ... |
| 1 | package com.topdraw.business.module.common.domain; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import lombok.experimental.Accessors; | ||
| 5 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 6 | |||
| 7 | import javax.persistence.Entity; | ||
| 8 | import javax.persistence.EntityListeners; | ||
| 9 | import javax.persistence.Transient; | ||
| 10 | import java.io.Serializable; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @author : | ||
| 14 | * @description: | ||
| 15 | * @function : | ||
| 16 | * @date :Created in 2022/2/10 10:12 | ||
| 17 | * @version: : | ||
| 18 | * @modified By: | ||
| 19 | * @since : modified in 2022/2/10 10:12 | ||
| 20 | */ | ||
| 21 | @Data | ||
| 22 | @Accessors(chain = true) | ||
| 23 | public class DefaultAsyncMqModule { | ||
| 24 | |||
| 25 | @Transient | ||
| 26 | private String memberCode; | ||
| 27 | |||
| 28 | } |
| ... | @@ -11,6 +11,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ... | @@ -11,6 +11,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
| 11 | import java.sql.Timestamp; | 11 | import java.sql.Timestamp; |
| 12 | 12 | ||
| 13 | import java.io.Serializable; | 13 | import java.io.Serializable; |
| 14 | import java.time.LocalDateTime; | ||
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| 16 | * @author XiangHan | 17 | * @author XiangHan |
| ... | @@ -87,12 +88,12 @@ public class MemberAddress implements Serializable { | ... | @@ -87,12 +88,12 @@ public class MemberAddress implements Serializable { |
| 87 | // 创建时间 | 88 | // 创建时间 |
| 88 | @CreatedDate | 89 | @CreatedDate |
| 89 | @Column(name = "create_time") | 90 | @Column(name = "create_time") |
| 90 | private Timestamp createTime; | 91 | private LocalDateTime createTime; |
| 91 | 92 | ||
| 92 | // 更新时间 | 93 | // 更新时间 |
| 93 | @LastModifiedDate | 94 | @LastModifiedDate |
| 94 | @Column(name = "update_time") | 95 | @Column(name = "update_time") |
| 95 | private Timestamp updateTime; | 96 | private LocalDateTime updateTime; |
| 96 | 97 | ||
| 97 | public void copy(MemberAddress source){ | 98 | public void copy(MemberAddress source){ |
| 98 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | 99 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ... | ... |
| 1 | package com.topdraw.business.module.member.address.rest; | 1 | package com.topdraw.business.module.member.address.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | ||
| 3 | import com.topdraw.business.module.member.service.MemberService; | 4 | import com.topdraw.business.module.member.service.MemberService; |
| 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 5 | import com.topdraw.common.ResultInfo; | 6 | import com.topdraw.common.ResultInfo; |
| 6 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 7 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 7 | import com.topdraw.business.module.member.address.service.MemberAddressService; | 8 | import com.topdraw.business.module.member.address.service.MemberAddressService; |
| 8 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; | 9 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; |
| 10 | import lombok.extern.slf4j.Slf4j; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.data.domain.Pageable; | 12 | import org.springframework.data.domain.Pageable; |
| 11 | import org.springframework.util.Assert; | 13 | import org.springframework.util.Assert; |
| ... | @@ -21,8 +23,9 @@ import java.util.Objects; | ... | @@ -21,8 +23,9 @@ import java.util.Objects; |
| 21 | */ | 23 | */ |
| 22 | @Api(tags = "MemberAddress管理") | 24 | @Api(tags = "MemberAddress管理") |
| 23 | @RestController | 25 | @RestController |
| 24 | @RequestMapping("/api/MemberAddress") | 26 | @RequestMapping("/ucEngine/api/memberAddress") |
| 25 | @CrossOrigin | 27 | @CrossOrigin |
| 28 | @Slf4j | ||
| 26 | public class MemberAddressController { | 29 | public class MemberAddressController { |
| 27 | 30 | ||
| 28 | @Autowired | 31 | @Autowired |
| ... | @@ -44,14 +47,25 @@ public class MemberAddressController { | ... | @@ -44,14 +47,25 @@ public class MemberAddressController { |
| 44 | 47 | ||
| 45 | @PostMapping(value = "/create") | 48 | @PostMapping(value = "/create") |
| 46 | @ApiOperation("新增MemberAddress") | 49 | @ApiOperation("新增MemberAddress") |
| 50 | @AnonymousAccess | ||
| 47 | public ResultInfo create(@Validated @RequestBody MemberAddress resources) { | 51 | public ResultInfo create(@Validated @RequestBody MemberAddress resources) { |
| 52 | log.info("MemberAddressController ==>> create ===>>[{}]",resources); | ||
| 53 | |||
| 54 | Long memberId = resources.getMemberId(); | ||
| 55 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
| 56 | String code = memberDTO.getCode(); | ||
| 57 | resources.setMemberCode(code); | ||
| 48 | MemberAddressService.create(resources); | 58 | MemberAddressService.create(resources); |
| 49 | return ResultInfo.success(); | 59 | return ResultInfo.success(); |
| 50 | } | 60 | } |
| 51 | 61 | ||
| 52 | @PutMapping(value = "/update") | 62 | @PutMapping(value = "/update") |
| 53 | @ApiOperation("修改MemberAddress") | 63 | @ApiOperation("修改MemberAddress") |
| 64 | @AnonymousAccess | ||
| 54 | public ResultInfo update(@Validated @RequestBody MemberAddress resources) { | 65 | public ResultInfo update(@Validated @RequestBody MemberAddress resources) { |
| 66 | |||
| 67 | log.info("MemberAddressController ==>> update ===>>[{}]",resources); | ||
| 68 | |||
| 55 | Long memberId = resources.getMemberId(); | 69 | Long memberId = resources.getMemberId(); |
| 56 | Integer sequence = resources.getSequence(); | 70 | Integer sequence = resources.getSequence(); |
| 57 | Assert.notNull(memberId,"memberId can't be null"); | 71 | Assert.notNull(memberId,"memberId can't be null"); |
| ... | @@ -68,6 +82,7 @@ public class MemberAddressController { | ... | @@ -68,6 +82,7 @@ public class MemberAddressController { |
| 68 | 82 | ||
| 69 | @DeleteMapping(value = "/delete/{id}") | 83 | @DeleteMapping(value = "/delete/{id}") |
| 70 | @ApiOperation("删除MemberAddress") | 84 | @ApiOperation("删除MemberAddress") |
| 85 | @AnonymousAccess | ||
| 71 | public ResultInfo delete(@PathVariable Long id) { | 86 | public ResultInfo delete(@PathVariable Long id) { |
| 72 | MemberAddressService.delete(id); | 87 | MemberAddressService.delete(id); |
| 73 | return ResultInfo.success(); | 88 | return ResultInfo.success(); | ... | ... |
| ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.service.dto; | ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.service.dto; |
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import java.sql.Timestamp; | 4 | import java.sql.Timestamp; |
| 5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
| 6 | import java.time.LocalDateTime; | ||
| 6 | 7 | ||
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| ... | @@ -55,8 +56,8 @@ public class MemberAddressDTO implements Serializable { | ... | @@ -55,8 +56,8 @@ public class MemberAddressDTO implements Serializable { |
| 55 | private String zipCode; | 56 | private String zipCode; |
| 56 | 57 | ||
| 57 | // 创建时间 | 58 | // 创建时间 |
| 58 | private Timestamp createTime; | 59 | private LocalDateTime createTime; |
| 59 | 60 | ||
| 60 | // 更新时间 | 61 | // 更新时间 |
| 61 | private Timestamp updateTime; | 62 | private LocalDateTime updateTime; |
| 62 | } | 63 | } | ... | ... |
| ... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.address.service.impl; | ... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.address.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 4 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 5 | import com.topdraw.business.module.member.service.MemberService; | ||
| 5 | import com.topdraw.utils.ValidationUtil; | 6 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.module.member.address.repository.MemberAddressRepository; | 7 | import com.topdraw.business.module.member.address.repository.MemberAddressRepository; |
| 7 | import com.topdraw.business.module.member.address.service.MemberAddressService; | 8 | import com.topdraw.business.module.member.address.service.MemberAddressService; | ... | ... |
| ... | @@ -7,7 +7,9 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; | ... | @@ -7,7 +7,9 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 7 | import com.topdraw.common.ResultInfo; | 7 | import com.topdraw.common.ResultInfo; |
| 8 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 8 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 9 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 9 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
| 10 | import com.topdraw.util.Base64Util; | ||
| 10 | import com.topdraw.utils.StringUtils; | 11 | import com.topdraw.utils.StringUtils; |
| 12 | import lombok.extern.slf4j.Slf4j; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.util.Assert; | 14 | import org.springframework.util.Assert; |
| 13 | import org.springframework.validation.annotation.Validated; | 15 | import org.springframework.validation.annotation.Validated; |
| ... | @@ -24,6 +26,7 @@ import java.util.Objects; | ... | @@ -24,6 +26,7 @@ import java.util.Objects; |
| 24 | @RestController | 26 | @RestController |
| 25 | @RequestMapping("/ucEngine/api/memberProfile") | 27 | @RequestMapping("/ucEngine/api/memberProfile") |
| 26 | @CrossOrigin | 28 | @CrossOrigin |
| 29 | @Slf4j | ||
| 27 | public class MemberProfileController { | 30 | public class MemberProfileController { |
| 28 | 31 | ||
| 29 | @Autowired | 32 | @Autowired |
| ... | @@ -47,6 +50,8 @@ public class MemberProfileController { | ... | @@ -47,6 +50,8 @@ public class MemberProfileController { |
| 47 | @ApiOperation("新增MemberProfile") | 50 | @ApiOperation("新增MemberProfile") |
| 48 | @AnonymousAccess | 51 | @AnonymousAccess |
| 49 | public ResultInfo create(@Validated @RequestBody MemberProfile resources) { | 52 | public ResultInfo create(@Validated @RequestBody MemberProfile resources) { |
| 53 | log.info("MemberProfileServiceImpl ==>> create ==>> resources ===>> [{}]",resources); | ||
| 54 | String realname = resources.getRealname(); | ||
| 50 | MemberProfileService.create(resources); | 55 | MemberProfileService.create(resources); |
| 51 | return ResultInfo.success(); | 56 | return ResultInfo.success(); |
| 52 | } | 57 | } |
| ... | @@ -55,6 +60,9 @@ public class MemberProfileController { | ... | @@ -55,6 +60,9 @@ public class MemberProfileController { |
| 55 | @ApiOperation("修改MemberProfile") | 60 | @ApiOperation("修改MemberProfile") |
| 56 | @AnonymousAccess | 61 | @AnonymousAccess |
| 57 | public ResultInfo update(@Validated @RequestBody MemberProfile resources) { | 62 | public ResultInfo update(@Validated @RequestBody MemberProfile resources) { |
| 63 | |||
| 64 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | ||
| 65 | |||
| 58 | Long memberId = resources.getMemberId(); | 66 | Long memberId = resources.getMemberId(); |
| 59 | Assert.notNull(memberId,"memberId can't be null"); | 67 | Assert.notNull(memberId,"memberId can't be null"); |
| 60 | MemberDTO memberDTO = this.memberService.findById(memberId); | 68 | MemberDTO memberDTO = this.memberService.findById(memberId); |
| ... | @@ -79,6 +87,7 @@ public class MemberProfileController { | ... | @@ -79,6 +87,7 @@ public class MemberProfileController { |
| 79 | @ApiOperation("修改MemberProfile") | 87 | @ApiOperation("修改MemberProfile") |
| 80 | @AnonymousAccess | 88 | @AnonymousAccess |
| 81 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { | 89 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { |
| 90 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | ||
| 82 | this.MemberProfileService.updateMemberProfileAndMember(resources); | 91 | this.MemberProfileService.updateMemberProfileAndMember(resources); |
| 83 | return ResultInfo.success(); | 92 | return ResultInfo.success(); |
| 84 | } | 93 | } | ... | ... |
| ... | @@ -6,6 +6,7 @@ import com.topdraw.business.module.member.domain.Member; | ... | @@ -6,6 +6,7 @@ import com.topdraw.business.module.member.domain.Member; |
| 6 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 6 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 7 | import com.topdraw.business.module.member.profile.domain.MemberProfileBuild; | 7 | import com.topdraw.business.module.member.profile.domain.MemberProfileBuild; |
| 8 | import com.topdraw.business.module.member.repository.MemberRepository; | 8 | import com.topdraw.business.module.member.repository.MemberRepository; |
| 9 | import com.topdraw.business.module.member.service.MemberService; | ||
| 9 | import com.topdraw.utils.StringUtils; | 10 | import com.topdraw.utils.StringUtils; |
| 10 | import com.topdraw.utils.ValidationUtil; | 11 | import com.topdraw.utils.ValidationUtil; |
| 11 | import com.topdraw.business.module.member.profile.repository.MemberProfileRepository; | 12 | import com.topdraw.business.module.member.profile.repository.MemberProfileRepository; |
| ... | @@ -13,6 +14,7 @@ import com.topdraw.business.module.member.profile.service.MemberProfileService; | ... | @@ -13,6 +14,7 @@ import com.topdraw.business.module.member.profile.service.MemberProfileService; |
| 13 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 14 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 14 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; | 15 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; |
| 15 | import com.topdraw.business.module.member.profile.service.mapper.MemberProfileMapper; | 16 | import com.topdraw.business.module.member.profile.service.mapper.MemberProfileMapper; |
| 17 | import lombok.extern.slf4j.Slf4j; | ||
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
| 18 | import org.springframework.transaction.annotation.Propagation; | 20 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -36,6 +38,7 @@ import java.util.Optional; | ... | @@ -36,6 +38,7 @@ import java.util.Optional; |
| 36 | */ | 38 | */ |
| 37 | @Service | 39 | @Service |
| 38 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 40 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
| 41 | @Slf4j | ||
| 39 | public class MemberProfileServiceImpl implements MemberProfileService { | 42 | public class MemberProfileServiceImpl implements MemberProfileService { |
| 40 | 43 | ||
| 41 | @Autowired | 44 | @Autowired |
| ... | @@ -46,6 +49,8 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -46,6 +49,8 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
| 46 | 49 | ||
| 47 | @Autowired | 50 | @Autowired |
| 48 | private MemberProfileMapper MemberProfileMapper; | 51 | private MemberProfileMapper MemberProfileMapper; |
| 52 | @Autowired | ||
| 53 | private MemberService memberService; | ||
| 49 | 54 | ||
| 50 | 55 | ||
| 51 | @Override | 56 | @Override |
| ... | @@ -70,12 +75,14 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -70,12 +75,14 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
| 70 | @Transactional(rollbackFor = Exception.class) | 75 | @Transactional(rollbackFor = Exception.class) |
| 71 | @AsyncMqSend() | 76 | @AsyncMqSend() |
| 72 | public MemberProfile create(MemberProfile resources) { | 77 | public MemberProfile create(MemberProfile resources) { |
| 78 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | ||
| 73 | MemberProfileRepository.save(resources); | 79 | MemberProfileRepository.save(resources); |
| 74 | return resources; | 80 | return resources; |
| 75 | } | 81 | } |
| 76 | 82 | ||
| 77 | @Override | 83 | @Override |
| 78 | public MemberProfile createDefault(MemberProfile resources) { | 84 | public MemberProfile createDefault(MemberProfile resources) { |
| 85 | |||
| 79 | Long memberId = resources.getMemberId(); | 86 | Long memberId = resources.getMemberId(); |
| 80 | String realname = resources.getRealname(); | 87 | String realname = resources.getRealname(); |
| 81 | Integer gender = resources.getGender(); | 88 | Integer gender = resources.getGender(); |
| ... | @@ -88,9 +95,14 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -88,9 +95,14 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
| 88 | @Transactional(rollbackFor = Exception.class) | 95 | @Transactional(rollbackFor = Exception.class) |
| 89 | @AsyncMqSend() | 96 | @AsyncMqSend() |
| 90 | public void update(MemberProfile resources) { | 97 | public void update(MemberProfile resources) { |
| 98 | |||
| 99 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | ||
| 100 | |||
| 91 | MemberProfile MemberProfile = MemberProfileRepository.findById(resources.getId()).orElseGet(MemberProfile::new); | 101 | MemberProfile MemberProfile = MemberProfileRepository.findById(resources.getId()).orElseGet(MemberProfile::new); |
| 92 | ValidationUtil.isNull( MemberProfile.getId(),"MemberProfile","id",resources.getId()); | 102 | ValidationUtil.isNull( MemberProfile.getId(),"MemberProfile","id",resources.getId()); |
| 93 | MemberProfile.copy(resources); | 103 | MemberProfile.copy(resources); |
| 104 | |||
| 105 | log.info("MemberProfileServiceImpl ==>> update ==>> copy ===>> resources ===>> [{}]",resources); | ||
| 94 | MemberProfileRepository.save(MemberProfile); | 106 | MemberProfileRepository.save(MemberProfile); |
| 95 | } | 107 | } |
| 96 | 108 | ||
| ... | @@ -117,6 +129,7 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -117,6 +129,7 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
| 117 | @Override | 129 | @Override |
| 118 | @Transactional(rollbackFor = Exception.class) | 130 | @Transactional(rollbackFor = Exception.class) |
| 119 | public void updateMemberProfileAndMember(MemberProfile resources) { | 131 | public void updateMemberProfileAndMember(MemberProfile resources) { |
| 132 | log.info("MemberProfileServiceImpl ==>> updateMemberProfileAndMember ==>> resources ===>> [{}]",resources); | ||
| 120 | String realname = resources.getRealname(); | 133 | String realname = resources.getRealname(); |
| 121 | String nickNameStr = ""; | 134 | String nickNameStr = ""; |
| 122 | if (StringUtils.isNotBlank(realname)) { | 135 | if (StringUtils.isNotBlank(realname)) { |
| ... | @@ -141,8 +154,9 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -141,8 +154,9 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
| 141 | member.setBirthday(DateUtil.format(resources.getBirthday(), "yyyy-MM-dd")); | 154 | member.setBirthday(DateUtil.format(resources.getBirthday(), "yyyy-MM-dd")); |
| 142 | member.setAvatarUrl(resources.getAvatarUrl()); | 155 | member.setAvatarUrl(resources.getAvatarUrl()); |
| 143 | 156 | ||
| 144 | memberRepository.save(member); | 157 | // memberRepository.save(member); |
| 145 | //memberService.update(member); | 158 | log.info("updateMemberProfileAndMember ==>> member ==>> [{}]",member); |
| 159 | memberService.update(member); | ||
| 146 | } | 160 | } |
| 147 | 161 | ||
| 148 | } | 162 | } | ... | ... |
| ... | @@ -49,6 +49,12 @@ public class MemberRelatedInfoController { | ... | @@ -49,6 +49,12 @@ public class MemberRelatedInfoController { |
| 49 | @ApiOperation("新增MemberRelatedInfo") | 49 | @ApiOperation("新增MemberRelatedInfo") |
| 50 | @AnonymousAccess | 50 | @AnonymousAccess |
| 51 | public ResultInfo create(@Validated @RequestBody MemberRelatedInfo resources) { | 51 | public ResultInfo create(@Validated @RequestBody MemberRelatedInfo resources) { |
| 52 | String name = resources.getName(); | ||
| 53 | if (StringUtils.hasText(name)) { | ||
| 54 | String nickNameEncode = Base64Util.encode(name); | ||
| 55 | resources.setName(nickNameEncode); | ||
| 56 | } | ||
| 57 | |||
| 52 | MemberRelatedInfoService.create(resources); | 58 | MemberRelatedInfoService.create(resources); |
| 53 | return ResultInfo.success(); | 59 | return ResultInfo.success(); |
| 54 | } | 60 | } | ... | ... |
| ... | @@ -53,6 +53,7 @@ public class MemberController { | ... | @@ -53,6 +53,7 @@ public class MemberController { |
| 53 | 53 | ||
| 54 | @PostMapping(value = "/create") | 54 | @PostMapping(value = "/create") |
| 55 | @ApiOperation("新增Member") | 55 | @ApiOperation("新增Member") |
| 56 | @AnonymousAccess | ||
| 56 | public ResultInfo create(@Validated @RequestBody Member resources) { | 57 | public ResultInfo create(@Validated @RequestBody Member resources) { |
| 57 | Long id = memberService.create(resources); | 58 | Long id = memberService.create(resources); |
| 58 | return ResultInfo.success(id); | 59 | return ResultInfo.success(id); | ... | ... |
| 1 | package com.topdraw.business.module.member.service; | 1 | package com.topdraw.business.module.member.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | ||
| 3 | import com.topdraw.business.module.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
| 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.module.member.service.dto.MemberQueryCriteria; | 7 | import com.topdraw.business.module.member.service.dto.MemberQueryCriteria; |
| 7 | import org.springframework.data.domain.Pageable; | 8 | import org.springframework.data.domain.Pageable; |
| 9 | import org.springframework.transaction.annotation.Transactional; | ||
| 8 | 10 | ||
| 9 | import java.util.List; | 11 | import java.util.List; |
| 10 | import java.util.Map; | 12 | import java.util.Map; |
| ... | @@ -44,12 +46,17 @@ public interface MemberService { | ... | @@ -44,12 +46,17 @@ public interface MemberService { |
| 44 | */ | 46 | */ |
| 45 | Long create(Member resources); | 47 | Long create(Member resources); |
| 46 | 48 | ||
| 49 | Member createAndReturnMember(Member resources); | ||
| 50 | |||
| 47 | /** | 51 | /** |
| 48 | * | 52 | * |
| 49 | * @param resources | 53 | * @param resources |
| 50 | */ | 54 | */ |
| 51 | void update(Member resources); | 55 | void update(Member resources); |
| 52 | 56 | ||
| 57 | |||
| 58 | void unbind(Member resources); | ||
| 59 | |||
| 53 | /** | 60 | /** |
| 54 | * | 61 | * |
| 55 | * @param id | 62 | * @param id | ... | ... |
| ... | @@ -14,6 +14,8 @@ import java.time.LocalDateTime; | ... | @@ -14,6 +14,8 @@ import java.time.LocalDateTime; |
| 14 | @Data | 14 | @Data |
| 15 | public class MemberDTO implements Serializable { | 15 | public class MemberDTO implements Serializable { |
| 16 | 16 | ||
| 17 | private String platformAccount; | ||
| 18 | |||
| 17 | // iptv绑定的主会员 0:否 1:是 | 19 | // iptv绑定的主会员 0:否 1:是 |
| 18 | private Integer iptvMajor; | 20 | private Integer iptvMajor; |
| 19 | 21 | ... | ... |
| ... | @@ -78,12 +78,20 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -78,12 +78,20 @@ public class MemberServiceImpl implements MemberService { |
| 78 | @Transactional(rollbackFor = Exception.class) | 78 | @Transactional(rollbackFor = Exception.class) |
| 79 | @AsyncMqSend | 79 | @AsyncMqSend |
| 80 | public Long create(Member resources) { | 80 | public Long create(Member resources) { |
| 81 | log.info("start=====>>>>>resources======>>>>接收到的数据 --->>>> " + resources); | ||
| 82 | Member member = this.checkMemberData(resources); | 81 | Member member = this.checkMemberData(resources); |
| 83 | memberRepository.save(member); | 82 | memberRepository.save(member); |
| 84 | return member.getId(); | 83 | return member.getId(); |
| 85 | } | 84 | } |
| 86 | 85 | ||
| 86 | @Override | ||
| 87 | @Transactional(rollbackFor = Exception.class) | ||
| 88 | @AsyncMqSend | ||
| 89 | public Member createAndReturnMember(Member resources) { | ||
| 90 | Member member = this.checkMemberData(resources); | ||
| 91 | memberRepository.save(member); | ||
| 92 | return resources; | ||
| 93 | } | ||
| 94 | |||
| 87 | private Member checkMemberData(Member member) { | 95 | private Member checkMemberData(Member member) { |
| 88 | Long defaultValue = 0L; | 96 | Long defaultValue = 0L; |
| 89 | String code = member.getCode(); | 97 | String code = member.getCode(); |
| ... | @@ -131,6 +139,25 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -131,6 +139,25 @@ public class MemberServiceImpl implements MemberService { |
| 131 | } | 139 | } |
| 132 | } | 140 | } |
| 133 | 141 | ||
| 142 | @Override | ||
| 143 | @Transactional(rollbackFor = Exception.class) | ||
| 144 | @AsyncMqSend() | ||
| 145 | public void unbind(Member resources) { | ||
| 146 | RLock rLock = this.redissonClient.getLock("member::update::id" + resources.getId().toString()); | ||
| 147 | try { | ||
| 148 | RedissonUtil.lock(rLock); | ||
| 149 | Member member = memberRepository.findById(resources.getId()).orElseGet(Member::new); | ||
| 150 | ValidationUtil.isNull(member.getId(), "Member", "id", resources.getId()); | ||
| 151 | member.copy(resources); | ||
| 152 | this.save(member); | ||
| 153 | } catch (Exception e) { | ||
| 154 | e.printStackTrace(); | ||
| 155 | throw e; | ||
| 156 | } finally { | ||
| 157 | RedissonUtil.unlock(rLock); | ||
| 158 | } | ||
| 159 | } | ||
| 160 | |||
| 134 | private void save(Member member){ | 161 | private void save(Member member){ |
| 135 | memberRepository.save(member); | 162 | memberRepository.save(member); |
| 136 | } | 163 | } |
| ... | @@ -162,6 +189,7 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -162,6 +189,7 @@ public class MemberServiceImpl implements MemberService { |
| 162 | } | 189 | } |
| 163 | 190 | ||
| 164 | @Override | 191 | @Override |
| 192 | @AsyncMqSend() | ||
| 165 | public void doUpdateMemberPoints(Member resources) { | 193 | public void doUpdateMemberPoints(Member resources) { |
| 166 | RLock rLock = this.redissonClient.getLock("member::update::id" + resources.getId().toString()); | 194 | RLock rLock = this.redissonClient.getLock("member::update::id" + resources.getId().toString()); |
| 167 | try { | 195 | try { | ... | ... |
| 1 | package com.topdraw.business.module.points.available.domain; | 1 | package com.topdraw.business.module.points.available.domain; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.module.common.domain.DefaultAsyncMqModule; | ||
| 3 | import lombok.Data; | 4 | import lombok.Data; |
| 4 | import lombok.experimental.Accessors; | 5 | import lombok.experimental.Accessors; |
| 5 | import cn.hutool.core.bean.BeanUtil; | 6 | import cn.hutool.core.bean.BeanUtil; |
| ... | @@ -24,11 +25,7 @@ import java.io.Serializable; | ... | @@ -24,11 +25,7 @@ import java.io.Serializable; |
| 24 | @EntityListeners(AuditingEntityListener.class) | 25 | @EntityListeners(AuditingEntityListener.class) |
| 25 | @Accessors(chain = true) | 26 | @Accessors(chain = true) |
| 26 | @Table(name="uc_points_available") | 27 | @Table(name="uc_points_available") |
| 27 | public class PointsAvailable implements Serializable { | 28 | public class PointsAvailable extends DefaultAsyncMqModule implements Serializable { |
| 28 | |||
| 29 | /** 会员编号 */ | ||
| 30 | @Transient | ||
| 31 | private String memberCode; | ||
| 32 | 29 | ||
| 33 | // 主键 | 30 | // 主键 |
| 34 | @Id | 31 | @Id | ... | ... |
| 1 | package com.topdraw.business.module.rights.history.domain; | 1 | package com.topdraw.business.module.rights.history.domain; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.module.common.domain.DefaultAsyncMqModule; | ||
| 3 | import lombok.Data; | 4 | import lombok.Data; |
| 4 | import lombok.experimental.Accessors; | 5 | import lombok.experimental.Accessors; |
| 5 | import cn.hutool.core.bean.BeanUtil; | 6 | import cn.hutool.core.bean.BeanUtil; |
| ... | @@ -22,7 +23,7 @@ import java.time.LocalDateTime; | ... | @@ -22,7 +23,7 @@ import java.time.LocalDateTime; |
| 22 | @EntityListeners(AuditingEntityListener.class) | 23 | @EntityListeners(AuditingEntityListener.class) |
| 23 | @Accessors(chain = true) | 24 | @Accessors(chain = true) |
| 24 | @Table(name="tr_rights_histroy") | 25 | @Table(name="tr_rights_histroy") |
| 25 | public class RightsHistory implements Serializable { | 26 | public class RightsHistory extends DefaultAsyncMqModule implements Serializable { |
| 26 | 27 | ||
| 27 | // 主键id | 28 | // 主键id |
| 28 | @Id | 29 | @Id | ... | ... |
| ... | @@ -66,7 +66,7 @@ public class RightsHistoryServiceImpl implements RightsHistoryService { | ... | @@ -66,7 +66,7 @@ public class RightsHistoryServiceImpl implements RightsHistoryService { |
| 66 | @AsyncMqSend() | 66 | @AsyncMqSend() |
| 67 | public void update(RightsHistory resources) { | 67 | public void update(RightsHistory resources) { |
| 68 | RightsHistory RightsHistory = RightsHistoryRepository.findById(resources.getId()).orElseGet(RightsHistory::new); | 68 | RightsHistory RightsHistory = RightsHistoryRepository.findById(resources.getId()).orElseGet(RightsHistory::new); |
| 69 | ValidationUtil.isNull( RightsHistory.getId(),"RightsHistory","id",resources.getId()); | 69 | ValidationUtil.isNull(RightsHistory.getId(),"RightsHistory","id",resources.getId()); |
| 70 | RightsHistory.copy(resources); | 70 | RightsHistory.copy(resources); |
| 71 | RightsHistoryRepository.save(RightsHistory); | 71 | RightsHistoryRepository.save(RightsHistory); |
| 72 | } | 72 | } | ... | ... |
| 1 | package com.topdraw.business.module.user.iptv.service; | 1 | package com.topdraw.business.module.user.iptv.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | ||
| 3 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 4 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 4 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 5 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 5 | import com.topdraw.business.module.user.iptv.service.dto.UserTvQueryCriteria; | 6 | import com.topdraw.business.module.user.iptv.service.dto.UserTvQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 7 | import org.springframework.data.domain.Pageable; |
| 8 | import org.springframework.transaction.annotation.Transactional; | ||
| 9 | |||
| 7 | import java.util.Map; | 10 | import java.util.Map; |
| 8 | import java.util.List; | 11 | import java.util.List; |
| 9 | 12 | ||
| ... | @@ -39,6 +42,8 @@ public interface UserTvService { | ... | @@ -39,6 +42,8 @@ public interface UserTvService { |
| 39 | 42 | ||
| 40 | void update(UserTv resources); | 43 | void update(UserTv resources); |
| 41 | 44 | ||
| 45 | void unbindPriorityMemberCode(UserTv resources); | ||
| 46 | |||
| 42 | void delete(Long id); | 47 | void delete(Long id); |
| 43 | 48 | ||
| 44 | UserTvDTO findByPlatformAccount(String platformAccount); | 49 | UserTvDTO findByPlatformAccount(String platformAccount); | ... | ... |
| ... | @@ -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 String memberCode; | ||
| 16 | |||
| 15 | /** 绑定的小屏账户会员编码 */ | 17 | /** 绑定的小屏账户会员编码 */ |
| 16 | private String priorityMemberCode; | 18 | private String priorityMemberCode; |
| 17 | 19 | ... | ... |
| ... | @@ -88,6 +88,16 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -88,6 +88,16 @@ public class UserTvServiceImpl implements UserTvService { |
| 88 | @Override | 88 | @Override |
| 89 | @Transactional(rollbackFor = Exception.class) | 89 | @Transactional(rollbackFor = Exception.class) |
| 90 | @AsyncMqSend | 90 | @AsyncMqSend |
| 91 | public void unbindPriorityMemberCode(UserTv resources) { | ||
| 92 | UserTv UserTv = UserTvRepository.findById(resources.getId()).orElseGet(UserTv::new); | ||
| 93 | ValidationUtil.isNull( UserTv.getId(),"UserTv","id",resources.getId()); | ||
| 94 | UserTv.copy(resources); | ||
| 95 | UserTvRepository.save(UserTv); | ||
| 96 | } | ||
| 97 | |||
| 98 | @Override | ||
| 99 | @Transactional(rollbackFor = Exception.class) | ||
| 100 | @AsyncMqSend | ||
| 91 | public void delete(Long id) { | 101 | public void delete(Long id) { |
| 92 | Assert.notNull(id, "The given id must not be null!"); | 102 | Assert.notNull(id, "The given id must not be null!"); |
| 93 | UserTv UserTv = UserTvRepository.findById(id).orElseThrow( | 103 | UserTv UserTv = UserTvRepository.findById(id).orElseThrow( | ... | ... |
| ... | @@ -70,11 +70,13 @@ public class UserCollectionDetailServiceImpl implements UserCollectionDetailServ | ... | @@ -70,11 +70,13 @@ public class UserCollectionDetailServiceImpl implements UserCollectionDetailServ |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @Override | 72 | @Override |
| 73 | @Transactional(rollbackFor = Exception.class) | ||
| 73 | public void deleteAllByUserCollectionId(Long id) { | 74 | public void deleteAllByUserCollectionId(Long id) { |
| 74 | this.userCollectionDetailRepository.deleteAllByUserCollectionId(id); | 75 | this.userCollectionDetailRepository.deleteAllByUserCollectionId(id); |
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | @Override | 78 | @Override |
| 79 | @Transactional(rollbackFor = Exception.class) | ||
| 78 | public void deleteAll(List<UserCollectionDetail> userCollectionDetailOptional) { | 80 | public void deleteAll(List<UserCollectionDetail> userCollectionDetailOptional) { |
| 79 | this.userCollectionDetailRepository.deleteAll(userCollectionDetailOptional); | 81 | this.userCollectionDetailRepository.deleteAll(userCollectionDetailOptional); |
| 80 | } | 82 | } | ... | ... |
| 1 | package com.topdraw.business.module.user.weixin.domain; | 1 | package com.topdraw.business.module.user.weixin.domain; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.module.common.domain.DefaultAsyncMqModule; | ||
| 3 | import lombok.Data; | 4 | import lombok.Data; |
| 4 | import lombok.experimental.Accessors; | 5 | import lombok.experimental.Accessors; |
| 5 | import cn.hutool.core.bean.BeanUtil; | 6 | import cn.hutool.core.bean.BeanUtil; |
| ... | @@ -21,7 +22,7 @@ import java.io.Serializable; | ... | @@ -21,7 +22,7 @@ import java.io.Serializable; |
| 21 | @EntityListeners(AuditingEntityListener.class) | 22 | @EntityListeners(AuditingEntityListener.class) |
| 22 | @Accessors(chain = true) | 23 | @Accessors(chain = true) |
| 23 | @Table(name="uc_user_weixin") | 24 | @Table(name="uc_user_weixin") |
| 24 | public class UserWeixin implements Serializable { | 25 | public class UserWeixin extends DefaultAsyncMqModule implements Serializable { |
| 25 | 26 | ||
| 26 | // ID | 27 | // ID |
| 27 | @Id | 28 | @Id | ... | ... |
| ... | @@ -3,7 +3,11 @@ package com.topdraw.business.module.user.weixin.repository; | ... | @@ -3,7 +3,11 @@ package com.topdraw.business.module.user.weixin.repository; |
| 3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 6 | import org.springframework.data.jpa.repository.Modifying; | ||
| 7 | import org.springframework.data.jpa.repository.Query; | ||
| 8 | import org.springframework.data.repository.query.Param; | ||
| 6 | 9 | ||
| 10 | import javax.transaction.Transactional; | ||
| 7 | import java.util.Optional; | 11 | import java.util.Optional; |
| 8 | 12 | ||
| 9 | /** | 13 | /** |
| ... | @@ -21,4 +25,9 @@ public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, J | ... | @@ -21,4 +25,9 @@ public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, J |
| 21 | Optional<UserWeixin> findFirstByUnionid(String unionid); | 25 | Optional<UserWeixin> findFirstByUnionid(String unionid); |
| 22 | 26 | ||
| 23 | Optional<UserWeixin> findFirstByUnionidAndAppid(String unionid, String appId); | 27 | Optional<UserWeixin> findFirstByUnionidAndAppid(String unionid, String appId); |
| 28 | |||
| 29 | @Modifying | ||
| 30 | @Transactional | ||
| 31 | @Query(value = "update uc_user_weixin set update_time = :#{#resources.updateTime} where appid = :#{#resources.appid} and openid = :#{#resources.openid}" , nativeQuery = true) | ||
| 32 | void updateTime(@Param("resources") UserWeixin resources); | ||
| 24 | } | 33 | } | ... | ... |
| ... | @@ -40,6 +40,8 @@ public interface UserWeixinService { | ... | @@ -40,6 +40,8 @@ public interface UserWeixinService { |
| 40 | 40 | ||
| 41 | void update(UserWeixin resources); | 41 | void update(UserWeixin resources); |
| 42 | 42 | ||
| 43 | void updateTime(UserWeixin resources); | ||
| 44 | |||
| 43 | void delete(Long id); | 45 | void delete(Long id); |
| 44 | 46 | ||
| 45 | UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid); | 47 | UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid); | ... | ... |
| 1 | package com.topdraw.business.module.user.weixin.service.impl; | 1 | package com.topdraw.business.module.user.weixin.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | ||
| 3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 4 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 4 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 5 | import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository; | 6 | import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository; |
| ... | @@ -55,6 +56,7 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -55,6 +56,7 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
| 55 | 56 | ||
| 56 | @Override | 57 | @Override |
| 57 | @Transactional(rollbackFor = Exception.class) | 58 | @Transactional(rollbackFor = Exception.class) |
| 59 | @AsyncMqSend | ||
| 58 | public UserWeixin create(UserWeixin resources) { | 60 | public UserWeixin create(UserWeixin resources) { |
| 59 | UserWeixinRepository.save(resources); | 61 | UserWeixinRepository.save(resources); |
| 60 | return resources; | 62 | return resources; |
| ... | @@ -62,6 +64,7 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -62,6 +64,7 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
| 62 | 64 | ||
| 63 | @Override | 65 | @Override |
| 64 | @Transactional(rollbackFor = Exception.class) | 66 | @Transactional(rollbackFor = Exception.class) |
| 67 | @AsyncMqSend | ||
| 65 | public void update(UserWeixin resources) { | 68 | public void update(UserWeixin resources) { |
| 66 | UserWeixin UserWeixin = UserWeixinRepository.findById(resources.getId()).orElseGet(UserWeixin::new); | 69 | UserWeixin UserWeixin = UserWeixinRepository.findById(resources.getId()).orElseGet(UserWeixin::new); |
| 67 | ValidationUtil.isNull( UserWeixin.getId(),"UserWeixin","id",resources.getId()); | 70 | ValidationUtil.isNull( UserWeixin.getId(),"UserWeixin","id",resources.getId()); |
| ... | @@ -70,6 +73,12 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -70,6 +73,12 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
| 70 | } | 73 | } |
| 71 | 74 | ||
| 72 | @Override | 75 | @Override |
| 76 | @AsyncMqSend | ||
| 77 | public void updateTime(UserWeixin resources) { | ||
| 78 | UserWeixinRepository.updateTime(resources); | ||
| 79 | } | ||
| 80 | |||
| 81 | @Override | ||
| 73 | @Transactional(rollbackFor = Exception.class) | 82 | @Transactional(rollbackFor = Exception.class) |
| 74 | public void delete(Long id) { | 83 | public void delete(Long id) { |
| 75 | Assert.notNull(id, "The given id must not be null!"); | 84 | Assert.notNull(id, "The given id must not be null!"); | ... | ... |
| ... | @@ -13,9 +13,10 @@ import java.sql.Timestamp; | ... | @@ -13,9 +13,10 @@ import java.sql.Timestamp; |
| 13 | @NoArgsConstructor | 13 | @NoArgsConstructor |
| 14 | public class TempIptvUser { | 14 | public class TempIptvUser { |
| 15 | 15 | ||
| 16 | private String unionid; | ||
| 17 | |||
| 16 | // 账户 | 18 | // 账户 |
| 17 | @Transient | 19 | @Transient |
| 18 | @NotNull(message = "platformAccount can't be null",groups = UnbindGroup.class) | ||
| 19 | private String platformAccount; | 20 | private String platformAccount; |
| 20 | 21 | ||
| 21 | // 分数 | 22 | // 分数 |
| ... | @@ -86,8 +87,6 @@ public class TempIptvUser { | ... | @@ -86,8 +87,6 @@ public class TempIptvUser { |
| 86 | // 会员id | 87 | // 会员id |
| 87 | private Long memberId; | 88 | private Long memberId; |
| 88 | 89 | ||
| 89 | // 会员编码 | ||
| 90 | @NotNull(message = "memberCode can't be null",groups = UnbindGroup.class) | ||
| 91 | private String memberCode; | 90 | private String memberCode; |
| 92 | 91 | ||
| 93 | 92 | ... | ... |
| 1 | package com.topdraw.business.process.domian.weixin; | 1 | package com.topdraw.business.process.domian.weixin; |
| 2 | 2 | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | import java.time.LocalDateTime; | ||
| 7 | |||
| 6 | /** | 8 | /** |
| 7 | * 微信账户信息 | 9 | * 微信账户信息 |
| 8 | * @author XiangHan | 10 | * @author XiangHan |
| ... | @@ -13,5 +15,8 @@ public class BuyVipBean extends WeiXinUserBean { | ... | @@ -13,5 +15,8 @@ public class BuyVipBean extends WeiXinUserBean { |
| 13 | 15 | ||
| 14 | private Integer vip; | 16 | private Integer vip; |
| 15 | 17 | ||
| 18 | @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 19 | private LocalDateTime vipExpireTime; | ||
| 20 | |||
| 16 | 21 | ||
| 17 | } | 22 | } | ... | ... |
| ... | @@ -15,6 +15,18 @@ public class SubscribeBean extends WeiXinUserBean { | ... | @@ -15,6 +15,18 @@ public class SubscribeBean extends WeiXinUserBean { |
| 15 | 15 | ||
| 16 | private String event; | 16 | private String event; |
| 17 | 17 | ||
| 18 | |||
| 19 | /** */ | ||
| 20 | private String openId; | ||
| 21 | |||
| 22 | /** */ | ||
| 23 | private String appId; | ||
| 24 | |||
| 25 | /** */ | ||
| 18 | private String eventKey; | 26 | private String eventKey; |
| 19 | 27 | ||
| 28 | private String unionid; | ||
| 29 | private String nickname; | ||
| 30 | private String headimgurl; | ||
| 31 | |||
| 20 | } | 32 | } | ... | ... |
| 1 | package com.topdraw.business.process.rest; | 1 | package com.topdraw.business.process.rest; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.ObjectUtil; | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | 4 | import com.topdraw.annotation.AnonymousAccess; |
| 4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 6 | import com.topdraw.business.module.member.service.MemberService; | ||
| 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 8 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 9 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | ||
| 10 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | ||
| 11 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
| 6 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | 12 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; |
| 7 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | 13 | import com.topdraw.business.process.domian.weixin.BuyVipBean; |
| 8 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | 14 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; |
| 9 | import com.topdraw.business.process.service.MemberOperationService; | 15 | import com.topdraw.business.process.service.MemberOperationService; |
| 10 | import com.topdraw.common.IResultInfo; | 16 | import com.topdraw.common.IResultInfo; |
| 11 | import com.topdraw.common.ResultInfo; | 17 | import com.topdraw.common.ResultInfo; |
| 18 | import com.topdraw.exception.BadRequestException; | ||
| 19 | import com.topdraw.weixin.util.WeChatConstants; | ||
| 12 | import io.swagger.annotations.Api; | 20 | import io.swagger.annotations.Api; |
| 13 | import io.swagger.annotations.ApiOperation; | 21 | import io.swagger.annotations.ApiOperation; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.web.bind.annotation.*; | 23 | import org.springframework.web.bind.annotation.*; |
| 16 | 24 | ||
| 25 | import java.time.LocalDateTime; | ||
| 26 | import java.util.Objects; | ||
| 27 | |||
| 17 | @Api("会员处理") | 28 | @Api("会员处理") |
| 18 | @RestController | 29 | @RestController |
| 19 | @RequestMapping(value = "/ucEngine/api/memberOperation") | 30 | @RequestMapping(value = "/ucEngine/api/memberOperation") |
| ... | @@ -21,6 +32,12 @@ public class MemberOperationController { | ... | @@ -21,6 +32,12 @@ public class MemberOperationController { |
| 21 | 32 | ||
| 22 | @Autowired | 33 | @Autowired |
| 23 | private MemberOperationService memberOperationService; | 34 | private MemberOperationService memberOperationService; |
| 35 | @Autowired | ||
| 36 | private MemberVipHistoryService memberVipHistoryService; | ||
| 37 | @Autowired | ||
| 38 | private UserWeixinService userWeixinService; | ||
| 39 | @Autowired | ||
| 40 | private MemberService memberService; | ||
| 24 | 41 | ||
| 25 | @GetMapping("/getMemberProfileAndCheckVip/{appId}/{memberId}") | 42 | @GetMapping("/getMemberProfileAndCheckVip/{appId}/{memberId}") |
| 26 | @ApiOperation("获取会员基本信息并且检查vip状态") | 43 | @ApiOperation("获取会员基本信息并且检查vip状态") |
| ... | @@ -34,9 +51,57 @@ public class MemberOperationController { | ... | @@ -34,9 +51,57 @@ public class MemberOperationController { |
| 34 | @ApiOperation("购买vip") | 51 | @ApiOperation("购买vip") |
| 35 | @AnonymousAccess | 52 | @AnonymousAccess |
| 36 | public ResultInfo buyVip(@RequestBody BuyVipBean buyVipBean) { | 53 | public ResultInfo buyVip(@RequestBody BuyVipBean buyVipBean) { |
| 54 | |||
| 55 | // 小程序账户id | ||
| 56 | Long id = buyVipBean.getId(); | ||
| 57 | if (Objects.isNull(id)) | ||
| 58 | throw new BadRequestException("参数异常: id is null !"); | ||
| 59 | |||
| 60 | // vip等级 | ||
| 61 | Integer vip = buyVipBean.getVip(); | ||
| 62 | if (Objects.isNull(vip) || vip <= 0) | ||
| 63 | throw new BadRequestException("vip 等级有误"); | ||
| 64 | |||
| 37 | MemberDTO memberDTO = memberOperationService.buyVip(buyVipBean); | 65 | MemberDTO memberDTO = memberOperationService.buyVip(buyVipBean); |
| 66 | |||
| 67 | LocalDateTime vipExpireTime = buyVipBean.getVipExpireTime(); | ||
| 68 | this.doInsertVipHistory(id,vip,vipExpireTime); | ||
| 38 | return ResultInfo.success(memberDTO); | 69 | return ResultInfo.success(memberDTO); |
| 39 | } | 70 | } |
| 71 | |||
| 72 | private void doInsertVipHistory(Long id,Integer vip,LocalDateTime vipExpireTime) { | ||
| 73 | |||
| 74 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id); | ||
| 75 | Long memberId = userWeixinDTO.getMemberId(); | ||
| 76 | |||
| 77 | MemberDTO member = this.memberService.findById(memberId); | ||
| 78 | |||
| 79 | LocalDateTime now = LocalDateTime.now(); | ||
| 80 | |||
| 81 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | ||
| 82 | if (ObjectUtil.isNull(vipExpireTime)) { | ||
| 83 | LocalDateTime localDateTime = now.plusYears(1L); | ||
| 84 | member.setVipExpireTime(localDateTime); | ||
| 85 | } else { | ||
| 86 | //购买过 判断当前时间有没有过vip过期时间,没有过,失效时间加一年; 过了,当前时间加一年 | ||
| 87 | //区分是当前vip续费 还是买新的vip | ||
| 88 | if (ObjectUtil.equal(vip, member.getVip())) { | ||
| 89 | if (now.isBefore(vipExpireTime)) { | ||
| 90 | LocalDateTime localDateTime = vipExpireTime.plusYears(1L); | ||
| 91 | member.setVipExpireTime(localDateTime); | ||
| 92 | } else { | ||
| 93 | LocalDateTime localDateTime = now.plusYears(1L); | ||
| 94 | member.setVipExpireTime(localDateTime); | ||
| 95 | } | ||
| 96 | } else { | ||
| 97 | LocalDateTime localDateTime = now.plusYears(1L); | ||
| 98 | member.setVipExpireTime(localDateTime); | ||
| 99 | } | ||
| 100 | } | ||
| 101 | |||
| 102 | memberVipHistory.setVipExpireTime(member.getVipExpireTime()); | ||
| 103 | memberVipHistoryService.create(memberVipHistory); | ||
| 104 | } | ||
| 40 | } | 105 | } |
| 41 | 106 | ||
| 42 | 107 | ... | ... |
| 1 | package com.topdraw.business.process.rest; | 1 | package com.topdraw.business.process.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | ||
| 3 | import com.topdraw.business.module.member.service.MemberService; | 4 | import com.topdraw.business.module.member.service.MemberService; |
| 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 5 | import com.topdraw.business.module.points.available.service.PointsAvailableService; | 6 | import com.topdraw.business.module.points.available.service.PointsAvailableService; |
| ... | @@ -58,12 +59,14 @@ public class PointsOperationController { | ... | @@ -58,12 +59,14 @@ public class PointsOperationController { |
| 58 | 59 | ||
| 59 | @GetMapping(value = "/pagePointsDetails") | 60 | @GetMapping(value = "/pagePointsDetails") |
| 60 | @ApiOperation("查询PointsDetail") | 61 | @ApiOperation("查询PointsDetail") |
| 62 | @AnonymousAccess | ||
| 61 | public ResultInfo pagePointsDetails(PointsDetailQueryCriteria criteria, Pageable pageable) { | 63 | public ResultInfo pagePointsDetails(PointsDetailQueryCriteria criteria, Pageable pageable) { |
| 62 | return ResultInfo.successPage(pointsDetailService.queryAll(criteria,pageable)); | 64 | return ResultInfo.successPage(pointsDetailService.queryAll(criteria,pageable)); |
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | @GetMapping(value = "/pageAvailablePoints") | 67 | @GetMapping(value = "/pageAvailablePoints") |
| 66 | @ApiOperation("查询PointsAvailable") | 68 | @ApiOperation("查询PointsAvailable") |
| 69 | @AnonymousAccess | ||
| 67 | public ResultInfo pageAvailablePoints(PointsAvailableQueryCriteria criteria, Pageable pageable) { | 70 | public ResultInfo pageAvailablePoints(PointsAvailableQueryCriteria criteria, Pageable pageable) { |
| 68 | PointsAvailableQueryType queryType = criteria.getQueryType(); | 71 | PointsAvailableQueryType queryType = criteria.getQueryType(); |
| 69 | // 可用 | 72 | // 可用 |
| ... | @@ -75,6 +78,7 @@ public class PointsOperationController { | ... | @@ -75,6 +78,7 @@ public class PointsOperationController { |
| 75 | 78 | ||
| 76 | @GetMapping(value = "/cleanInvalidPointsAndCalculateCurrentPoints/{id}") | 79 | @GetMapping(value = "/cleanInvalidPointsAndCalculateCurrentPoints/{id}") |
| 77 | @ApiOperation("清除过期积分并计算总积分,供客户端会员查询积分时调用") | 80 | @ApiOperation("清除过期积分并计算总积分,供客户端会员查询积分时调用") |
| 81 | @AnonymousAccess | ||
| 78 | public ResultInfo cleanInvalidPointsAndCalculateCurrentPoints(@PathVariable("id") Long id) { | 82 | public ResultInfo cleanInvalidPointsAndCalculateCurrentPoints(@PathVariable("id") Long id) { |
| 79 | Long aLong = this.pointsOperationService.cleanInvalidPointsAndCalculateCurrentPoints(id); | 83 | Long aLong = this.pointsOperationService.cleanInvalidPointsAndCalculateCurrentPoints(id); |
| 80 | return ResultInfo.success(Objects.isNull(aLong) ? 0L : aLong); | 84 | return ResultInfo.success(Objects.isNull(aLong) ? 0L : aLong); |
| ... | @@ -82,6 +86,7 @@ public class PointsOperationController { | ... | @@ -82,6 +86,7 @@ public class PointsOperationController { |
| 82 | 86 | ||
| 83 | @PostMapping(value = "/grantPointsByManual") | 87 | @PostMapping(value = "/grantPointsByManual") |
| 84 | @ApiOperation("手动发放积分") | 88 | @ApiOperation("手动发放积分") |
| 89 | @AnonymousAccess | ||
| 85 | public ResultInfo grantPointsByManual(@Validated @RequestBody TempPoints tempPoints) { | 90 | public ResultInfo grantPointsByManual(@Validated @RequestBody TempPoints tempPoints) { |
| 86 | Long memberId = tempPoints.getMemberId(); | 91 | Long memberId = tempPoints.getMemberId(); |
| 87 | Long points = tempPoints.getPoints(); | 92 | Long points = tempPoints.getPoints(); |
| ... | @@ -104,6 +109,7 @@ public class PointsOperationController { | ... | @@ -104,6 +109,7 @@ public class PointsOperationController { |
| 104 | */ | 109 | */ |
| 105 | @PostMapping(value = "/customPointsByUserTvPlatformAccount") | 110 | @PostMapping(value = "/customPointsByUserTvPlatformAccount") |
| 106 | @ApiOperation("通过大屏账户积分消耗") | 111 | @ApiOperation("通过大屏账户积分消耗") |
| 112 | @AnonymousAccess | ||
| 107 | public ResultInfo customPointsByUserTvPlatformAccount(@Validated @RequestBody TempCustomPointBean tempIptvUser) { | 113 | public ResultInfo customPointsByUserTvPlatformAccount(@Validated @RequestBody TempCustomPointBean tempIptvUser) { |
| 108 | String platformAccount = tempIptvUser.getPlatformAccount(); | 114 | String platformAccount = tempIptvUser.getPlatformAccount(); |
| 109 | Long points = tempIptvUser.getPoints(); | 115 | Long points = tempIptvUser.getPoints(); |
| ... | @@ -142,6 +148,7 @@ public class PointsOperationController { | ... | @@ -142,6 +148,7 @@ public class PointsOperationController { |
| 142 | */ | 148 | */ |
| 143 | @PostMapping(value = "/customPointsByUserId") | 149 | @PostMapping(value = "/customPointsByUserId") |
| 144 | @ApiOperation("积分消耗") | 150 | @ApiOperation("积分消耗") |
| 151 | @AnonymousAccess | ||
| 145 | public ResultInfo customPointsByUserId(@Validated @RequestBody TempPoints tempPoints) { | 152 | public ResultInfo customPointsByUserId(@Validated @RequestBody TempPoints tempPoints) { |
| 146 | Long userId = tempPoints.getUserId(); | 153 | Long userId = tempPoints.getUserId(); |
| 147 | // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 154 | // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) |
| ... | @@ -182,6 +189,7 @@ public class PointsOperationController { | ... | @@ -182,6 +189,7 @@ public class PointsOperationController { |
| 182 | 189 | ||
| 183 | @PostMapping(value = "/consumePoints") | 190 | @PostMapping(value = "/consumePoints") |
| 184 | @ApiOperation("积分消耗") | 191 | @ApiOperation("积分消耗") |
| 192 | @AnonymousAccess | ||
| 185 | public ResultInfo customPoints(@Validated @RequestBody TempPoints tempPoints) { | 193 | public ResultInfo customPoints(@Validated @RequestBody TempPoints tempPoints) { |
| 186 | Integer pointsType = tempPoints.getPointsType(); | 194 | Integer pointsType = tempPoints.getPointsType(); |
| 187 | if (Objects.isNull(pointsType)) { | 195 | if (Objects.isNull(pointsType)) { | ... | ... |
| ... | @@ -5,8 +5,11 @@ import cn.hutool.core.util.StrUtil; | ... | @@ -5,8 +5,11 @@ import cn.hutool.core.util.StrUtil; |
| 5 | import com.alibaba.fastjson.JSONObject; | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | import com.topdraw.annotation.AnonymousAccess; | 6 | import com.topdraw.annotation.AnonymousAccess; |
| 7 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 7 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 8 | import com.topdraw.business.module.member.service.MemberService; | ||
| 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 9 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 9 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 10 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 11 | import com.topdraw.business.module.user.iptv.service.UserTvService; | ||
| 12 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | ||
| 10 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 13 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 11 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | 14 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
| 12 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 15 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| ... | @@ -17,15 +20,14 @@ import com.topdraw.business.process.domian.weixin.SubscribeBean; | ... | @@ -17,15 +20,14 @@ import com.topdraw.business.process.domian.weixin.SubscribeBean; |
| 17 | import com.topdraw.business.process.domian.weixin.SubscribeBeanEvent; | 20 | import com.topdraw.business.process.domian.weixin.SubscribeBeanEvent; |
| 18 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | 21 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; |
| 19 | import com.topdraw.business.process.service.UserOperationService; | 22 | import com.topdraw.business.process.service.UserOperationService; |
| 20 | import com.topdraw.common.IResultInfo; | ||
| 21 | import com.topdraw.common.ResultInfo; | 23 | import com.topdraw.common.ResultInfo; |
| 22 | import com.topdraw.config.RedisKeyUtil; | 24 | import com.topdraw.config.RedisKeyUtil; |
| 23 | import com.topdraw.exception.BadRequestException; | 25 | import com.topdraw.exception.BadRequestException; |
| 26 | import com.topdraw.util.Base64Util; | ||
| 24 | import com.topdraw.util.JSONUtil; | 27 | import com.topdraw.util.JSONUtil; |
| 25 | import com.topdraw.utils.RedisUtils; | 28 | import com.topdraw.utils.RedisUtils; |
| 26 | import com.topdraw.utils.StringUtils; | 29 | import com.topdraw.utils.StringUtils; |
| 27 | import com.topdraw.weixin.util.WeChatConstants; | 30 | import com.topdraw.weixin.util.WeChatConstants; |
| 28 | import com.topdraw.weixin.util.WeiXinRequestUtil; | ||
| 29 | import com.topdraw.weixin.util.WeixinUtil; | 31 | import com.topdraw.weixin.util.WeixinUtil; |
| 30 | import io.swagger.annotations.Api; | 32 | import io.swagger.annotations.Api; |
| 31 | import io.swagger.annotations.ApiOperation; | 33 | import io.swagger.annotations.ApiOperation; |
| ... | @@ -37,6 +39,8 @@ import org.springframework.validation.annotation.Validated; | ... | @@ -37,6 +39,8 @@ import org.springframework.validation.annotation.Validated; |
| 37 | import org.springframework.web.bind.annotation.*; | 39 | import org.springframework.web.bind.annotation.*; |
| 38 | 40 | ||
| 39 | import java.io.IOException; | 41 | import java.io.IOException; |
| 42 | import java.net.URLDecoder; | ||
| 43 | import java.util.Base64; | ||
| 40 | import java.util.List; | 44 | import java.util.List; |
| 41 | import java.util.Map; | 45 | import java.util.Map; |
| 42 | import java.util.Objects; | 46 | import java.util.Objects; |
| ... | @@ -52,7 +56,9 @@ public class UserOperationController { | ... | @@ -52,7 +56,9 @@ public class UserOperationController { |
| 52 | @Autowired | 56 | @Autowired |
| 53 | private UserWeixinService userWeixinService; | 57 | private UserWeixinService userWeixinService; |
| 54 | @Autowired | 58 | @Autowired |
| 55 | private WeiXinRequestUtil weixinRequestUtil; | 59 | private UserTvService userTvService; |
| 60 | @Autowired | ||
| 61 | private MemberService memberService; | ||
| 56 | @Autowired | 62 | @Autowired |
| 57 | private RedisUtils redisUtils; | 63 | private RedisUtils redisUtils; |
| 58 | 64 | ||
| ... | @@ -134,23 +140,56 @@ public class UserOperationController { | ... | @@ -134,23 +140,56 @@ public class UserOperationController { |
| 134 | return ResultInfo.success(result); | 140 | return ResultInfo.success(result); |
| 135 | } | 141 | } |
| 136 | 142 | ||
| 137 | @PutMapping(value = "/unbind") | 143 | @RequestMapping(value = "/unbind") |
| 138 | @ApiOperation("大屏用户解绑") | 144 | @ApiOperation("大屏用户解绑") |
| 139 | @AnonymousAccess | 145 | @AnonymousAccess |
| 140 | public ResultInfo unbind(@Validated(value = {UnbindGroup.class}) @RequestBody TempIptvUser resources) { | 146 | public ResultInfo unbind(@Validated @RequestBody TempIptvUser resources) { |
| 141 | UserTv userTv = new UserTv(); | 147 | UserTv userTv = new UserTv(); |
| 142 | BeanUtils.copyProperties(resources,userTv); | 148 | BeanUtils.copyProperties(resources,userTv); |
| 149 | String unionid = resources.getUnionid(); | ||
| 150 | // Long memberId = resources.getMemberId(); | ||
| 151 | String memberCode1 = resources.getMemberCode(); | ||
| 152 | if (Objects.nonNull(memberCode1)) { | ||
| 153 | |||
| 154 | MemberDTO memberDTO = this.memberService.getByCode(memberCode1); | ||
| 155 | String memberCode = memberDTO.getCode(); | ||
| 156 | if (StringUtils.isNotBlank(memberCode)) { | ||
| 157 | userTv.setMemberCode(memberCode); | ||
| 143 | this.userTvOperationService.unbind(userTv); | 158 | this.userTvOperationService.unbind(userTv); |
| 159 | } | ||
| 160 | |||
| 161 | } else { | ||
| 162 | |||
| 163 | this.userTvOperationService.unbindByUnionId(userTv,unionid); | ||
| 164 | |||
| 165 | } | ||
| 166 | |||
| 144 | return ResultInfo.success(); | 167 | return ResultInfo.success(); |
| 145 | } | 168 | } |
| 146 | 169 | ||
| 147 | @PutMapping(value = "/changeMainAccount") | 170 | @RequestMapping(value = "/changeMainAccount") |
| 148 | @ApiOperation("大屏更换主账号") | 171 | @ApiOperation("大屏更换主账号") |
| 149 | @AnonymousAccess | 172 | @AnonymousAccess |
| 150 | public ResultInfo changeMainAccount(@Validated(value = {UnbindGroup.class}) @RequestBody TempIptvUser resources) { | 173 | public ResultInfo changeMainAccount(@Validated @RequestBody TempIptvUser resources) { |
| 151 | UserTv userTv = new UserTv(); | 174 | UserTv userTv = new UserTv(); |
| 152 | BeanUtils.copyProperties(resources,userTv); | 175 | BeanUtils.copyProperties(resources,userTv); |
| 176 | Long memberId = resources.getMemberId(); | ||
| 177 | String memberCode1 = resources.getMemberCode(); | ||
| 178 | if (Objects.nonNull(memberCode1)) { | ||
| 179 | |||
| 180 | MemberDTO memberDTO = this.memberService.getByCode(memberCode1); | ||
| 181 | |||
| 182 | String memberCode = memberDTO.getCode(); | ||
| 183 | if (StringUtils.isNotBlank(memberCode)) { | ||
| 184 | userTv.setMemberCode(memberCode); | ||
| 153 | this.userTvOperationService.changeMainAccount(userTv); | 185 | this.userTvOperationService.changeMainAccount(userTv); |
| 186 | } | ||
| 187 | |||
| 188 | } else { | ||
| 189 | String unionid = resources.getUnionid(); | ||
| 190 | this.userTvOperationService.changeMainAccountByUnionId(userTv,unionid); | ||
| 191 | } | ||
| 192 | |||
| 154 | return ResultInfo.success("update success"); | 193 | return ResultInfo.success("update success"); |
| 155 | } | 194 | } |
| 156 | 195 | ||
| ... | @@ -166,6 +205,7 @@ public class UserOperationController { | ... | @@ -166,6 +205,7 @@ public class UserOperationController { |
| 166 | @ApiOperation("微信小程序登录") | 205 | @ApiOperation("微信小程序登录") |
| 167 | @AnonymousAccess | 206 | @AnonymousAccess |
| 168 | public ResultInfo appletLogin(@Validated @RequestBody WeiXinUserBean resources) { | 207 | public ResultInfo appletLogin(@Validated @RequestBody WeiXinUserBean resources) { |
| 208 | |||
| 169 | UserWeixinDTO result = this.userTvOperationService.appletLogin(resources); | 209 | UserWeixinDTO result = this.userTvOperationService.appletLogin(resources); |
| 170 | return ResultInfo.success(result); | 210 | return ResultInfo.success(result); |
| 171 | } | 211 | } |
| ... | @@ -178,9 +218,13 @@ public class UserOperationController { | ... | @@ -178,9 +218,13 @@ public class UserOperationController { |
| 178 | if (StringUtils.isBlank(unionId)) | 218 | if (StringUtils.isBlank(unionId)) |
| 179 | Assert.state(StrUtil.isNotBlank(unionId), "跨屏绑定,请先进行授权"); | 219 | Assert.state(StrUtil.isNotBlank(unionId), "跨屏绑定,请先进行授权"); |
| 180 | 220 | ||
| 181 | Long platformUserId = resources.getPlatformUserId(); | 221 | String platformAccount = resources.getPlatformAccount(); |
| 182 | if (Objects.isNull(platformUserId)) | 222 | if (Objects.isNull(platformAccount)) |
| 183 | Assert.state(StrUtil.isNotBlank(unionId), "大屏id不得为空"); | 223 | Assert.state(StrUtil.isNotBlank(platformAccount), "大屏账户不得为空"); |
| 224 | |||
| 225 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 226 | resources.setPlatformUserId(userTvDTO.getId()); | ||
| 227 | resources.setPlatformAccount(platformAccount); | ||
| 184 | 228 | ||
| 185 | boolean result = this.userTvOperationService.appletBind(resources); | 229 | boolean result = this.userTvOperationService.appletBind(resources); |
| 186 | return ResultInfo.success(result); | 230 | return ResultInfo.success(result); |
| ... | @@ -190,12 +234,9 @@ public class UserOperationController { | ... | @@ -190,12 +234,9 @@ public class UserOperationController { |
| 190 | @ApiOperation("微信公众号关注") | 234 | @ApiOperation("微信公众号关注") |
| 191 | @AnonymousAccess | 235 | @AnonymousAccess |
| 192 | public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent data) throws IOException { | 236 | public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent data) throws IOException { |
| 193 | |||
| 194 | String content = data.getContent(); | 237 | String content = data.getContent(); |
| 195 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); | 238 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); |
| 196 | |||
| 197 | this.parseSubscribe(subscribeBean); | 239 | this.parseSubscribe(subscribeBean); |
| 198 | |||
| 199 | boolean result = this.userTvOperationService.subscribe(subscribeBean); | 240 | boolean result = this.userTvOperationService.subscribe(subscribeBean); |
| 200 | return ResultInfo.success(result); | 241 | return ResultInfo.success(result); |
| 201 | } | 242 | } |
| ... | @@ -209,18 +250,20 @@ public class UserOperationController { | ... | @@ -209,18 +250,20 @@ public class UserOperationController { |
| 209 | private void parseSubscribe(SubscribeBean subscribeBean) throws IOException { | 250 | private void parseSubscribe(SubscribeBean subscribeBean) throws IOException { |
| 210 | if (Objects.nonNull(subscribeBean)) { | 251 | if (Objects.nonNull(subscribeBean)) { |
| 211 | 252 | ||
| 212 | String appId = subscribeBean.getAppid(); | 253 | String appId = subscribeBean.getAppId(); |
| 213 | // appId不得为空 | 254 | // appId不得为空 |
| 214 | if (StringUtils.isBlank(appId)) | 255 | if (StringUtils.isBlank(appId)) |
| 215 | throw new BadRequestException("appId 不存在!"); | 256 | throw new BadRequestException("appId 不存在!"); |
| 216 | 257 | ||
| 217 | // openId | 258 | // openId |
| 218 | String openId = subscribeBean.getOpenid(); | 259 | String openId = subscribeBean.getOpenId(); |
| 219 | if (StringUtils.isBlank(openId)) | 260 | if (StringUtils.isBlank(openId)) |
| 220 | throw new BadRequestException("openId 不存在!"); | 261 | throw new BadRequestException("openId 不存在!"); |
| 221 | 262 | ||
| 222 | // unionId | 263 | // unionId |
| 223 | String unionId = null; | 264 | String unionId = subscribeBean.getUnionid(); |
| 265 | if (StringUtils.isBlank(unionId)) | ||
| 266 | throw new BadRequestException("unionId 不存在!"); | ||
| 224 | 267 | ||
| 225 | // 匹配配置文件中的微信列表信息 | 268 | // 匹配配置文件中的微信列表信息 |
| 226 | Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appId); | 269 | Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appId); |
| ... | @@ -231,23 +274,8 @@ public class UserOperationController { | ... | @@ -231,23 +274,8 @@ public class UserOperationController { |
| 231 | // 非订阅号,暂不处理。返回暂不支持 | 274 | // 非订阅号,暂不处理。返回暂不支持 |
| 232 | if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION)) | 275 | if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION)) |
| 233 | throw new BadRequestException("非订阅号"); | 276 | throw new BadRequestException("非订阅号"); |
| 234 | |||
| 235 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appId, openId); | ||
| 236 | if (Objects.nonNull(userWeixinDTO.getId())) { | ||
| 237 | unionId = userWeixinDTO.getUnionid(); | ||
| 238 | } else { | ||
| 239 | JSONObject userInfo = this.weixinRequestUtil.getUserInfo(wxInfoMap, openId); | ||
| 240 | unionId = userInfo.getString("unionid"); | ||
| 241 | } | 277 | } |
| 242 | 278 | ||
| 243 | } | ||
| 244 | |||
| 245 | // unionId不得为空 | ||
| 246 | if (StringUtils.isBlank(unionId)) | ||
| 247 | throw new BadRequestException("unionId 不存在!"); | ||
| 248 | |||
| 249 | subscribeBean.setUnionid(unionId); | ||
| 250 | |||
| 251 | // 大屏账户信息 | 279 | // 大屏账户信息 |
| 252 | JSONObject iptvUserInfo = null; | 280 | JSONObject iptvUserInfo = null; |
| 253 | // 缓存的大屏信息,使用unionid即可 | 281 | // 缓存的大屏信息,使用unionid即可 |
| ... | @@ -255,7 +283,6 @@ public class UserOperationController { | ... | @@ -255,7 +283,6 @@ public class UserOperationController { |
| 255 | if (StringUtils.isNotBlank(content)) { | 283 | if (StringUtils.isNotBlank(content)) { |
| 256 | // 大屏信息 | 284 | // 大屏信息 |
| 257 | iptvUserInfo = JSONObject.parseObject(content); | 285 | iptvUserInfo = JSONObject.parseObject(content); |
| 258 | |||
| 259 | } else { | 286 | } else { |
| 260 | 287 | ||
| 261 | String eventKey = subscribeBean.getEventKey(); | 288 | String eventKey = subscribeBean.getEventKey(); |
| ... | @@ -272,6 +299,20 @@ public class UserOperationController { | ... | @@ -272,6 +299,20 @@ public class UserOperationController { |
| 272 | // 用户自己搜索关注就没有大屏信息的话,否则表示扫码关注 | 299 | // 用户自己搜索关注就没有大屏信息的话,否则表示扫码关注 |
| 273 | if (Objects.nonNull(iptvUserInfo)) { | 300 | if (Objects.nonNull(iptvUserInfo)) { |
| 274 | subscribeBean.setIptvUserInfo(iptvUserInfo); | 301 | subscribeBean.setIptvUserInfo(iptvUserInfo); |
| 302 | |||
| 303 | String headimgurl = iptvUserInfo.get("headimgurl").toString(); | ||
| 304 | String nickname = iptvUserInfo.get("nickname").toString(); | ||
| 305 | if (org.apache.commons.lang3.StringUtils.isNotBlank(nickname)) { | ||
| 306 | String nicknameDecode = URLDecoder.decode(nickname, "UTF-8"); | ||
| 307 | String nicknameEncode = Base64Util.encode(nicknameDecode); | ||
| 308 | subscribeBean.setNickname(nicknameEncode); | ||
| 309 | } | ||
| 310 | |||
| 311 | if (org.apache.commons.lang3.StringUtils.isNotBlank(headimgurl)) { | ||
| 312 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); | ||
| 313 | subscribeBean.setHeadimgurl(headimgurlDecode); | ||
| 314 | } | ||
| 315 | |||
| 275 | } | 316 | } |
| 276 | 317 | ||
| 277 | } | 318 | } |
| ... | @@ -282,6 +323,8 @@ public class UserOperationController { | ... | @@ -282,6 +323,8 @@ public class UserOperationController { |
| 282 | @AnonymousAccess | 323 | @AnonymousAccess |
| 283 | public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent data) { | 324 | public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent data) { |
| 284 | String content = data.getContent(); | 325 | String content = data.getContent(); |
| 326 | log.info("content ==>> [{}]",content); | ||
| 327 | |||
| 285 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); | 328 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); |
| 286 | boolean result = this.userTvOperationService.unsubscribe(subscribeBean); | 329 | boolean result = this.userTvOperationService.unsubscribe(subscribeBean); |
| 287 | return ResultInfo.success(result); | 330 | return ResultInfo.success(result); |
| ... | @@ -310,7 +353,6 @@ public class UserOperationController { | ... | @@ -310,7 +353,6 @@ public class UserOperationController { |
| 310 | String unionid = json.getString("unionid"); | 353 | String unionid = json.getString("unionid"); |
| 311 | Assert.state(StrUtil.isNotBlank(unionid), "unionid不可为空"); | 354 | Assert.state(StrUtil.isNotBlank(unionid), "unionid不可为空"); |
| 312 | 355 | ||
| 313 | log.info("resources :[{}]",data); | ||
| 314 | String s = this.userTvOperationService.saveUserInfo(data); | 356 | String s = this.userTvOperationService.saveUserInfo(data); |
| 315 | 357 | ||
| 316 | return ResultInfo.success(s); | 358 | return ResultInfo.success(s); |
| ... | @@ -320,7 +362,6 @@ public class UserOperationController { | ... | @@ -320,7 +362,6 @@ public class UserOperationController { |
| 320 | @ApiOperation("保存用户手机号信息") | 362 | @ApiOperation("保存用户手机号信息") |
| 321 | @AnonymousAccess | 363 | @AnonymousAccess |
| 322 | public ResultInfo saveUserWeixinPhone(@RequestBody WeiXinUserBean resources) { | 364 | public ResultInfo saveUserWeixinPhone(@RequestBody WeiXinUserBean resources) { |
| 323 | log.info("resources :[{}]",resources); | ||
| 324 | MemberProfile s = this.userTvOperationService.saveUserWeixinPhone(resources); | 365 | MemberProfile s = this.userTvOperationService.saveUserWeixinPhone(resources); |
| 325 | return ResultInfo.success(s); | 366 | return ResultInfo.success(s); |
| 326 | } | 367 | } | ... | ... |
| ... | @@ -30,12 +30,26 @@ public interface UserOperationService { | ... | @@ -30,12 +30,26 @@ public interface UserOperationService { |
| 30 | void unbind(UserTv userTv); | 30 | void unbind(UserTv userTv); |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * | ||
| 34 | * @param userTv | ||
| 35 | * @param unionId | ||
| 36 | */ | ||
| 37 | void unbindByUnionId(UserTv userTv,String unionId); | ||
| 38 | |||
| 39 | /** | ||
| 33 | * 大屏切换主账户(会员) | 40 | * 大屏切换主账户(会员) |
| 34 | * @param userTv | 41 | * @param userTv |
| 35 | */ | 42 | */ |
| 36 | void changeMainAccount(UserTv userTv); | 43 | void changeMainAccount(UserTv userTv); |
| 37 | 44 | ||
| 38 | /** | 45 | /** |
| 46 | * | ||
| 47 | * @param userTv | ||
| 48 | * @param unionId | ||
| 49 | */ | ||
| 50 | void changeMainAccountByUnionId(UserTv userTv,String unionId); | ||
| 51 | |||
| 52 | /** | ||
| 39 | * 微信小程序登录 | 53 | * 微信小程序登录 |
| 40 | * @param resources | 54 | * @param resources |
| 41 | * @return | 55 | * @return | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | ||
| 3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; | 4 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
| 4 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; | 5 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; |
| 5 | import com.topdraw.business.module.coupon.service.CouponService; | 6 | import com.topdraw.business.module.coupon.service.CouponService; |
| ... | @@ -51,6 +52,7 @@ public class CouponOperationServiceImpl implements CouponOperationService { | ... | @@ -51,6 +52,7 @@ public class CouponOperationServiceImpl implements CouponOperationService { |
| 51 | private static final Integer EXPIRE_FACTOR_DAY = 30; | 52 | private static final Integer EXPIRE_FACTOR_DAY = 30; |
| 52 | 53 | ||
| 53 | @Override | 54 | @Override |
| 55 | @AsyncMqSend | ||
| 54 | public void grantCouponThroughTempCoupon(List<TempCoupon> tempCouponList) { | 56 | public void grantCouponThroughTempCoupon(List<TempCoupon> tempCouponList) { |
| 55 | // 优惠券领取、使用历史记录表 | 57 | // 优惠券领取、使用历史记录表 |
| 56 | for (TempCoupon tempCoupon : tempCouponList) { | 58 | for (TempCoupon tempCoupon : tempCouponList) { | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | ||
| 3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; | 4 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
| 4 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; | 5 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; |
| 5 | import com.topdraw.business.module.member.domain.Member; | 6 | import com.topdraw.business.module.member.domain.Member; |
| ... | @@ -50,6 +51,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -50,6 +51,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
| 50 | ThreadPoolTaskExecutor threadPoolTaskExecutor; | 51 | ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| 51 | 52 | ||
| 52 | @Override | 53 | @Override |
| 54 | @AsyncMqSend | ||
| 53 | public void grantPointsThroughTempExp(List<TempExp> tempExpList) { | 55 | public void grantPointsThroughTempExp(List<TempExp> tempExpList) { |
| 54 | 56 | ||
| 55 | for (TempExp tempExp : tempExpList) { | 57 | for (TempExp tempExp : tempExpList) { | ... | ... |
| ... | @@ -52,33 +52,45 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -52,33 +52,45 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 52 | 52 | ||
| 53 | @Override | 53 | @Override |
| 54 | public MemberDTO buyVip(BuyVipBean criteria) { | 54 | public MemberDTO buyVip(BuyVipBean criteria) { |
| 55 | // 小程序账户id | ||
| 56 | Long id = criteria.getId(); | ||
| 55 | 57 | ||
| 56 | // 查询微信账户 | 58 | // 过期时间 |
| 57 | UserWeixinDTO userWeixin = this.findWeiXinById(criteria.getId()); | 59 | LocalDateTime vipExpireTime1 = criteria.getVipExpireTime(); |
| 58 | 60 | Integer vip1 = criteria.getVip(); | |
| 59 | 61 | ||
| 62 | // 查询微信账户 | ||
| 63 | UserWeixinDTO userWeixin = this.findWeiXinById(id); | ||
| 60 | Long memberId = userWeixin.getMemberId(); | 64 | Long memberId = userWeixin.getMemberId(); |
| 61 | 65 | ||
| 66 | // | ||
| 62 | MemberDTO memberDTO = this.findById(memberId); | 67 | MemberDTO memberDTO = this.findById(memberId); |
| 63 | |||
| 64 | Integer vip = memberDTO.getVip(); | 68 | Integer vip = memberDTO.getVip(); |
| 65 | 69 | ||
| 66 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | 70 | // |
| 67 | memberVipHistory.setMemberId(memberId).setVip(criteria.getVip()).setBeforeVip(vip); | 71 | LocalDateTime vipExpireTime = memberDTO.getVipExpireTime(); |
| 68 | if (ObjectUtil.equal(criteria.getVip(),vip)) { | 72 | if (Objects.nonNull(vipExpireTime1)) { |
| 69 | memberVipHistory.setStatus(1); | 73 | vipExpireTime = vipExpireTime1; |
| 70 | } | 74 | } |
| 71 | 75 | ||
| 72 | LocalDateTime vipExpireTime = memberDTO.getVipExpireTime(); | ||
| 73 | LocalDateTime now = LocalDateTime.now(); | ||
| 74 | //判断之前有没有买过,没买过,失效时间为一年后; | 76 | //判断之前有没有买过,没买过,失效时间为一年后; |
| 77 | if (Objects.isNull(vipExpireTime1)) { | ||
| 75 | if (ObjectUtil.isNull(vipExpireTime)) { | 78 | if (ObjectUtil.isNull(vipExpireTime)) { |
| 76 | LocalDateTime localDateTime = now.plusYears(1L); | 79 | LocalDateTime now = LocalDateTime.now(); |
| 77 | memberDTO.setVipExpireTime(localDateTime); | 80 | vipExpireTime = now.plusYears(1L); |
| 78 | } else { | 81 | } else { |
| 82 | vipExpireTime = vipExpireTime.plusYears(1L); | ||
| 83 | } | ||
| 84 | |||
| 85 | } | ||
| 86 | |||
| 87 | memberDTO.setVip(vip1); | ||
| 88 | memberDTO.setVipExpireTime(vipExpireTime); | ||
| 89 | |||
| 90 | /*if (){ | ||
| 79 | //购买过 判断当前时间有没有过vip过期时间,没有过,失效时间加一年; 过了,当前时间加一年 | 91 | //购买过 判断当前时间有没有过vip过期时间,没有过,失效时间加一年; 过了,当前时间加一年 |
| 80 | //区分是当前vip续费 还是买新的vip | 92 | //区分是当前vip续费 还是买新的vip |
| 81 | if (ObjectUtil.equal(criteria.getVip(), memberDTO.getVip())) { | 93 | if (ObjectUtil.equal(vip1, memberDTO.getVip())) { |
| 82 | if (now.isBefore(vipExpireTime)) { | 94 | if (now.isBefore(vipExpireTime)) { |
| 83 | LocalDateTime localDateTime = vipExpireTime.plusYears(1L); | 95 | LocalDateTime localDateTime = vipExpireTime.plusYears(1L); |
| 84 | memberDTO.setVipExpireTime(localDateTime); | 96 | memberDTO.setVipExpireTime(localDateTime); |
| ... | @@ -90,12 +102,17 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -90,12 +102,17 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 90 | LocalDateTime localDateTime = now.plusYears(1L); | 102 | LocalDateTime localDateTime = now.plusYears(1L); |
| 91 | memberDTO.setVipExpireTime(localDateTime); | 103 | memberDTO.setVipExpireTime(localDateTime); |
| 92 | } | 104 | } |
| 93 | } | 105 | }*/ |
| 94 | memberDTO.setVip(criteria.getVip()); | ||
| 95 | 106 | ||
| 96 | Member member = new Member(); | 107 | Member member = new Member(); |
| 97 | BeanUtils.copyProperties(memberDTO,member); | 108 | BeanUtils.copyProperties(memberDTO,member); |
| 98 | this.memberService.create(member); | 109 | this.memberService.create(member); |
| 110 | |||
| 111 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | ||
| 112 | memberVipHistory.setMemberId(memberId).setVip(vip1).setBeforeVip(vip); | ||
| 113 | if (ObjectUtil.equal(vip1,vip)) { | ||
| 114 | memberVipHistory.setStatus(1); | ||
| 115 | } | ||
| 99 | memberVipHistory.setVipExpireTime(member.getVipExpireTime()); | 116 | memberVipHistory.setVipExpireTime(member.getVipExpireTime()); |
| 100 | memberVipHistoryService.create(memberVipHistory); | 117 | memberVipHistoryService.create(memberVipHistory); |
| 101 | 118 | ... | ... |
| ... | @@ -296,6 +296,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -296,6 +296,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
| 296 | */ | 296 | */ |
| 297 | @Override | 297 | @Override |
| 298 | @Transactional(rollbackFor = Exception.class) | 298 | @Transactional(rollbackFor = Exception.class) |
| 299 | @AsyncMqSend() | ||
| 299 | public void grantPointsThroughTempRightsList(List<TempPoints> tempPointsList){ | 300 | public void grantPointsThroughTempRightsList(List<TempPoints> tempPointsList){ |
| 300 | log.info("------->>grantPointsThroughTempRightsList start1"); | 301 | log.info("------->>grantPointsThroughTempRightsList start1"); |
| 301 | for (TempPoints tempPoints : tempPointsList){ | 302 | for (TempPoints tempPoints : tempPointsList){ | ... | ... |
| ... | @@ -102,6 +102,8 @@ public class RightsOperationServiceImpl implements RightsOperationService { | ... | @@ -102,6 +102,8 @@ public class RightsOperationServiceImpl implements RightsOperationService { |
| 102 | rightsHistory.setRightsId(value.getId()); | 102 | rightsHistory.setRightsId(value.getId()); |
| 103 | rightsHistory.setMemberId(value.getMemberId()); | 103 | rightsHistory.setMemberId(value.getMemberId()); |
| 104 | rightsHistory.setExpireTime(value.getExpireTime()); | 104 | rightsHistory.setExpireTime(value.getExpireTime()); |
| 105 | String memberCode = value.getMemberCode(); | ||
| 106 | rightsHistory.setMemberCode(memberCode); | ||
| 105 | rightsHistoryList.add(rightsHistory); | 107 | rightsHistoryList.add(rightsHistory); |
| 106 | }); | 108 | }); |
| 107 | 109 | ||
| ... | @@ -123,9 +125,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { | ... | @@ -123,9 +125,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { |
| 123 | * @param tempPointsList 权益列表 | 125 | * @param tempPointsList 权益列表 |
| 124 | */ | 126 | */ |
| 125 | private void grantPoint(List<TempPoints> tempPointsList) { | 127 | private void grantPoint(List<TempPoints> tempPointsList) { |
| 126 | log.info(Thread.currentThread().getName() + "=========>>grantPoint start"); | ||
| 127 | if (!CollectionUtils.isEmpty(tempPointsList)) | 128 | if (!CollectionUtils.isEmpty(tempPointsList)) |
| 128 | log.info("=======>> tempPointsList ======>> " + tempPointsList.toString()); | ||
| 129 | this.pointsOperationService.grantPointsThroughTempRightsList(tempPointsList); | 129 | this.pointsOperationService.grantPointsThroughTempRightsList(tempPointsList); |
| 130 | } | 130 | } |
| 131 | 131 | ... | ... |
| ... | @@ -99,7 +99,12 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -99,7 +99,12 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 99 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, DataSyncMsg.class); | 99 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, DataSyncMsg.class); |
| 100 | DataSyncMsg.MsgData msgData = dataSyncMsg.getMsg(); | 100 | DataSyncMsg.MsgData msgData = dataSyncMsg.getMsg(); |
| 101 | Integer event = msgData.getEvent(); | 101 | Integer event = msgData.getEvent(); |
| 102 | String memberCode = msgData.getMemberCode(); | ||
| 102 | Long memberId = msgData.getMemberId(); | 103 | Long memberId = msgData.getMemberId(); |
| 104 | if (StringUtils.hasText(memberCode)) { | ||
| 105 | MemberDTO memberDTO = this.memberService.getByCode(memberCode); | ||
| 106 | memberId = memberDTO.getId(); | ||
| 107 | } | ||
| 103 | 108 | ||
| 104 | // 检查当前会员的黑名单状态 | 109 | // 检查当前会员的黑名单状态 |
| 105 | boolean b = this.validatedMemberBlackStatus(memberId); | 110 | boolean b = this.validatedMemberBlackStatus(memberId); |
| ... | @@ -138,7 +143,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -138,7 +143,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 138 | * @return | 143 | * @return |
| 139 | */ | 144 | */ |
| 140 | private boolean checkRiskManagement(Long memberId , Map<RightType, Object> tempRightsMap) { | 145 | private boolean checkRiskManagement(Long memberId , Map<RightType, Object> tempRightsMap) { |
| 141 | 146 | // TODO 风控 | |
| 142 | return false; | 147 | return false; |
| 143 | } | 148 | } |
| 144 | 149 | ||
| ... | @@ -160,40 +165,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -160,40 +165,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 160 | } | 165 | } |
| 161 | 166 | ||
| 162 | /** | 167 | /** |
| 163 | * 永久权益 | ||
| 164 | * @param memberId 会员id | ||
| 165 | * @return PermanentRightsDTO 永久权益 | ||
| 166 | */ | ||
| 167 | @Deprecated | ||
| 168 | private PermanentRightsDTO getPermanentRights(Long memberId) { | ||
| 169 | PermanentRightsDTO permanentRights = null; | ||
| 170 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
| 171 | if (Objects.nonNull(memberDTO)) { | ||
| 172 | Integer level = memberDTO.getLevel(); | ||
| 173 | // 永久权益 | ||
| 174 | permanentRights = this.permanentRightsService.findByLevel(level); | ||
| 175 | } | ||
| 176 | return permanentRights; | ||
| 177 | } | ||
| 178 | |||
| 179 | /** | ||
| 180 | * 解析模板参数 | ||
| 181 | * @param taskTemplate 任务模板 | ||
| 182 | * @return Map<String, Object> 模板参数解析结果 | ||
| 183 | */ | ||
| 184 | @Deprecated | ||
| 185 | private Map<String, Object> parseTaskTemplateParam(TaskTemplate taskTemplate) { | ||
| 186 | if (Objects.nonNull(taskTemplate)) { | ||
| 187 | String params = taskTemplate.getParams(); | ||
| 188 | if (!StringUtils.isEmpty(params)) { | ||
| 189 | Map paramMap = JSONObject.parseObject(params,Map.class); | ||
| 190 | return paramMap; | ||
| 191 | } | ||
| 192 | } | ||
| 193 | return null; | ||
| 194 | } | ||
| 195 | |||
| 196 | /** | ||
| 197 | * 任务完成情况 | 168 | * 任务完成情况 |
| 198 | * @param resources 任务完成情况 | 169 | * @param resources 任务完成情况 |
| 199 | */ | 170 | */ |
| ... | @@ -320,13 +291,15 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -320,13 +291,15 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 320 | /** | 291 | /** |
| 321 | * 创建权益 | 292 | * 创建权益 |
| 322 | * @param memberId | 293 | * @param memberId |
| 294 | * @param memberCode | ||
| 323 | * @param rightsAmount | 295 | * @param rightsAmount |
| 324 | * @return | 296 | * @return |
| 325 | */ | 297 | */ |
| 326 | private TempRights tmpRightsBuild(Long memberId ,Integer rightsAmount,RightsDTO rightsDTO){ | 298 | private TempRights tmpRightsBuild(Long memberId ,String memberCode,Integer rightsAmount,RightsDTO rightsDTO){ |
| 327 | TempRights tempRights = new TempRights(); | 299 | TempRights tempRights = new TempRights(); |
| 328 | BeanUtils.copyProperties(rightsDTO,tempRights); | 300 | BeanUtils.copyProperties(rightsDTO,tempRights); |
| 329 | tempRights.setMemberId(memberId); | 301 | tempRights.setMemberId(memberId); |
| 302 | tempRights.setMemberCode(memberCode); | ||
| 330 | tempRights.setRightsAmount(rightsAmount); | 303 | tempRights.setRightsAmount(rightsAmount); |
| 331 | Long expireTime = rightsDTO.getExpireTime(); | 304 | Long expireTime = rightsDTO.getExpireTime(); |
| 332 | if (Objects.nonNull(expireTime)) | 305 | if (Objects.nonNull(expireTime)) |
| ... | @@ -337,14 +310,15 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -337,14 +310,15 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 337 | /** | 310 | /** |
| 338 | * 优惠券 | 311 | * 优惠券 |
| 339 | * @param memberId | 312 | * @param memberId |
| 340 | * @param rightsAmount | 313 | * @param memberCode |
| 341 | * @param rightsSendStrategy | 314 | * @param rightsSendStrategy |
| 342 | * @return | 315 | * @return |
| 343 | */ | 316 | */ |
| 344 | private TempCoupon tempCouponBuild(Long memberId ,Integer rightsAmount,Integer rightsSendStrategy,CouponDTO couponDTO,String nickname){ | 317 | private TempCoupon tempCouponBuild(Long memberId ,String memberCode , Integer rightsAmount,Integer rightsSendStrategy,CouponDTO couponDTO,String nickname){ |
| 345 | TempCoupon tempCoupon = new TempCoupon(); | 318 | TempCoupon tempCoupon = new TempCoupon(); |
| 346 | BeanUtils.copyProperties(couponDTO,tempCoupon); | 319 | BeanUtils.copyProperties(couponDTO,tempCoupon); |
| 347 | tempCoupon.setCode(couponDTO.getCode()); | 320 | tempCoupon.setCode(couponDTO.getCode()); |
| 321 | tempCoupon.setMemberCode(memberCode); | ||
| 348 | tempCoupon.setMemberId(memberId); | 322 | tempCoupon.setMemberId(memberId); |
| 349 | tempCoupon.setRightsAmount(rightsAmount); | 323 | tempCoupon.setRightsAmount(rightsAmount); |
| 350 | tempCoupon.setRightsSendStrategy(Objects.isNull(rightsSendStrategy) ? 0 : rightsSendStrategy); | 324 | tempCoupon.setRightsSendStrategy(Objects.isNull(rightsSendStrategy) ? 0 : rightsSendStrategy); |
| ... | @@ -426,12 +400,13 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -426,12 +400,13 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 426 | 400 | ||
| 427 | Long memberId = memberDTO.getId(); | 401 | Long memberId = memberDTO.getId(); |
| 428 | String nickname = memberDTO.getNickname(); | 402 | String nickname = memberDTO.getNickname(); |
| 403 | String memberCode = memberDTO.getCode(); | ||
| 429 | // 权益详情 | 404 | // 权益详情 |
| 430 | RightsDTO rightsDTO = this.getRight(rightsId); | 405 | RightsDTO rightsDTO = this.getRight(rightsId); |
| 431 | 406 | ||
| 432 | if (Objects.nonNull(rightsDTO)){ | 407 | if (Objects.nonNull(rightsDTO)){ |
| 433 | // 用以保存权益历史 | 408 | // 用以保存权益历史 |
| 434 | TempRights tempRights = this.tmpRightsBuild(memberId,rightsAmount,rightsDTO); | 409 | TempRights tempRights = this.tmpRightsBuild(memberId,memberCode,rightsAmount,rightsDTO); |
| 435 | rightsList.add(tempRights); | 410 | rightsList.add(tempRights); |
| 436 | 411 | ||
| 437 | // 权益类型 | 412 | // 权益类型 |
| ... | @@ -443,7 +418,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -443,7 +418,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 443 | CouponDTO couponDTO = this.findCouponById(entityId); | 418 | CouponDTO couponDTO = this.findCouponById(entityId); |
| 444 | if (Objects.nonNull(couponDTO)) { | 419 | if (Objects.nonNull(couponDTO)) { |
| 445 | // 优惠券 | 420 | // 优惠券 |
| 446 | TempCoupon tempCoupon = this.tempCouponBuild(memberId, rightsAmount, rightsSendStrategy, couponDTO, nickname); | 421 | TempCoupon tempCoupon = this.tempCouponBuild(memberId, memberCode,rightsAmount, rightsSendStrategy, couponDTO, nickname); |
| 447 | tempCouponList.add(tempCoupon); | 422 | tempCouponList.add(tempCoupon); |
| 448 | } | 423 | } |
| 449 | } | 424 | } |
| ... | @@ -484,6 +459,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -484,6 +459,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 484 | tempExp.setMemberId(memberId); | 459 | tempExp.setMemberId(memberId); |
| 485 | tempExp.setAppCode(msgData.getAppCode()); | 460 | tempExp.setAppCode(msgData.getAppCode()); |
| 486 | tempExp.setMemberId(msgData.getMemberId()); | 461 | tempExp.setMemberId(msgData.getMemberId()); |
| 462 | tempExp.setMemberCode(msgData.getMemberCode()); | ||
| 487 | tempExp.setItemId(msgData.getItemId()); | 463 | tempExp.setItemId(msgData.getItemId()); |
| 488 | tempExp.setAccountId(msgData.getAccountId()); | 464 | tempExp.setAccountId(msgData.getAccountId()); |
| 489 | tempExp.setRewardExp(task.getRewardExp()); | 465 | tempExp.setRewardExp(task.getRewardExp()); |
| ... | @@ -522,6 +498,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -522,6 +498,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 522 | } | 498 | } |
| 523 | tempPoints.setRewardPointsExpireTime(rewardPointsExpireTime); | 499 | tempPoints.setRewardPointsExpireTime(rewardPointsExpireTime); |
| 524 | tempPoints.setMemberId(memberId); | 500 | tempPoints.setMemberId(memberId); |
| 501 | tempPoints.setMemberCode(msgData.getMemberCode()); | ||
| 525 | tempPoints.setAppCode(msgData.getAppCode()); | 502 | tempPoints.setAppCode(msgData.getAppCode()); |
| 526 | tempPoints.setPoints(rewardPoints); | 503 | tempPoints.setPoints(rewardPoints); |
| 527 | tempPoints.setPointsType(pointsType); | 504 | tempPoints.setPointsType(pointsType); | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -10,6 +10,7 @@ import org.springframework.boot.test.context.SpringBootTest; | ... | @@ -10,6 +10,7 @@ import org.springframework.boot.test.context.SpringBootTest; |
| 10 | import org.springframework.test.context.junit4.SpringRunner; | 10 | import org.springframework.test.context.junit4.SpringRunner; |
| 11 | 11 | ||
| 12 | import java.sql.Timestamp; | 12 | import java.sql.Timestamp; |
| 13 | import java.time.LocalDateTime; | ||
| 13 | import java.util.Collection; | 14 | import java.util.Collection; |
| 14 | import java.util.HashMap; | 15 | import java.util.HashMap; |
| 15 | import java.util.Map; | 16 | import java.util.Map; |
| ... | @@ -49,4 +50,6 @@ public class BaseTest { | ... | @@ -49,4 +50,6 @@ public class BaseTest { |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | 52 | ||
| 53 | |||
| 54 | |||
| 52 | } | 55 | } | ... | ... |
-
Please register or sign in to post a comment