1.优化部分程序,清理警告信息
Showing
18 changed files
with
182 additions
and
206 deletions
| 1 | package com.topdraw.business.module.member.viphistory.rest; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 4 | import com.topdraw.business.process.service.member.MemberOperationService; | ||
| 5 | import com.topdraw.common.ResultInfo; | ||
| 6 | import io.swagger.annotations.Api; | ||
| 7 | import io.swagger.annotations.ApiOperation; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.validation.annotation.Validated; | ||
| 10 | import org.springframework.web.bind.annotation.*; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @author luerlong | ||
| 14 | * @date 2021-12-10 | ||
| 15 | */ | ||
| 16 | @Api(tags = "会员vip历史管理") | ||
| 17 | @RestController | ||
| 18 | @RequestMapping("/uce/memberVipHistory") | ||
| 19 | public class MemberVipHistoryController { | ||
| 20 | |||
| 21 | @Autowired | ||
| 22 | private MemberOperationService memberOperationService; | ||
| 23 | |||
| 24 | @PostMapping | ||
| 25 | @ApiOperation("新增MemberVipHistory") | ||
| 26 | public ResultInfo create(@Validated @RequestBody MemberVipHistory resources) { | ||
| 27 | this.memberOperationService.createVipHistory(resources); | ||
| 28 | return ResultInfo.success(); | ||
| 29 | } | ||
| 30 | |||
| 31 | } |
| ... | @@ -24,7 +24,7 @@ public interface MemberVipHistoryService { | ... | @@ -24,7 +24,7 @@ public interface MemberVipHistoryService { |
| 24 | * | 24 | * |
| 25 | * @param resources | 25 | * @param resources |
| 26 | */ | 26 | */ |
| 27 | void create(MemberVipHistory resources); | 27 | MemberVipHistoryDTO create(MemberVipHistory resources); |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * | 30 | * | ... | ... |
| ... | @@ -52,15 +52,14 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { | ... | @@ -52,15 +52,14 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { |
| 52 | 52 | ||
| 53 | @Override | 53 | @Override |
| 54 | @Transactional(rollbackFor = Exception.class) | 54 | @Transactional(rollbackFor = Exception.class) |
| 55 | @AsyncMqSend | 55 | public MemberVipHistoryDTO create(MemberVipHistory resources) { |
| 56 | public void create(MemberVipHistory resources) { | ||
| 57 | log.info("MemberVipHistoryServiceImpl ==>> MemberVipHistoryServiceImpl ==>> param ==>> [{}]",resources); | 56 | log.info("MemberVipHistoryServiceImpl ==>> MemberVipHistoryServiceImpl ==>> param ==>> [{}]",resources); |
| 58 | MemberDTO memberDTO = this.checkMember(resources); | 57 | MemberDTO memberDTO = this.checkMember(resources); |
| 59 | 58 | ||
| 60 | MemberVipHistory memberVipHistory = MemberVipHistoryBuilder.build(resources); | 59 | MemberVipHistory memberVipHistory = MemberVipHistoryBuilder.build(resources); |
| 61 | MemberVipHistory vipHistory = this.memberVipHistoryRepository.save(memberVipHistory); | 60 | MemberVipHistory vipHistory = this.memberVipHistoryRepository.save(memberVipHistory); |
| 62 | vipHistory.setMemberCode(memberDTO.getCode()); | 61 | vipHistory.setMemberCode(memberDTO.getCode()); |
| 63 | 62 | return this.memberVipHistoryMapper.toDto(vipHistory); | |
| 64 | } | 63 | } |
| 65 | 64 | ||
| 66 | @Override | 65 | @Override | ... | ... |
| 1 | package com.topdraw.business.module.rights.constant; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/18 16:06 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/18 16:06 | ||
| 11 | */ | ||
| 12 | public interface RightTypeConstants { | ||
| 13 | |||
| 14 | // 优惠券 | ||
| 15 | int DISCOUNT_COUPON = 1; | ||
| 16 | // 观影券 | ||
| 17 | int VIEW_COUPON= 2; | ||
| 18 | // 参加活动 | ||
| 19 | int JOIN_ACTIVITY = 3; | ||
| 20 | // 积分商品 | ||
| 21 | int POINTS_GOODS = 4; | ||
| 22 | // IPTV产品包 | ||
| 23 | int IPTV_PRODUCT = 5; | ||
| 24 | // IPTV观影权益 | ||
| 25 | int IPTV_VIEW = 6; | ||
| 26 | |||
| 27 | } |
| 1 | package com.topdraw.business.module.task.template.constant; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/18 14:30 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/18 14:30 | ||
| 11 | */ | ||
| 12 | public interface TaskEventType { | ||
| 13 | //类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置; | ||
| 14 | // 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他 | ||
| 15 | int LOGIN = 1; | ||
| 16 | int VIEW = 2; | ||
| 17 | int ACTIVITY = 3; | ||
| 18 | int ORDER = 4; | ||
| 19 | int MEMBER_PRIORITY = 5; | ||
| 20 | int SIGN = 6; | ||
| 21 | int COMPLETE_INFO = 7; | ||
| 22 | int PLAY = 8; | ||
| 23 | int BINDING = 10; | ||
| 24 | int POINTS_TRANS = 11; | ||
| 25 | int POINTS_EXCHANGE_GOODS = 30; | ||
| 26 | int SYSTEM_OPERATE = 98; | ||
| 27 | int OHHER = 99; | ||
| 28 | |||
| 29 | } |
| ... | @@ -2,25 +2,20 @@ package com.topdraw.business.process.rest; | ... | @@ -2,25 +2,20 @@ package com.topdraw.business.process.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | 3 | import com.topdraw.annotation.AnonymousAccess; |
| 4 | import com.topdraw.business.module.common.validated.UpdateGroup; | 4 | import com.topdraw.business.module.common.validated.UpdateGroup; |
| 5 | import com.topdraw.business.module.member.domain.Member; | ||
| 6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 8 | import com.topdraw.business.process.domian.member.MemberOperationBean; | 7 | import com.topdraw.business.process.domian.member.MemberOperationBean; |
| 9 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | ||
| 10 | import com.topdraw.business.process.service.member.MemberOperationService; | 8 | import com.topdraw.business.process.service.member.MemberOperationService; |
| 11 | import com.topdraw.common.IResultInfo; | 9 | import com.topdraw.common.IResultInfo; |
| 12 | import com.topdraw.common.ResultInfo; | 10 | import com.topdraw.common.ResultInfo; |
| 13 | import com.topdraw.exception.BadRequestException; | ||
| 14 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
| 15 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
| 16 | import lombok.extern.slf4j.Slf4j; | 13 | import lombok.extern.slf4j.Slf4j; |
| 17 | import org.apache.commons.lang3.StringUtils; | 14 | import org.apache.commons.lang3.StringUtils; |
| 18 | import org.springframework.beans.BeanUtils; | ||
| 19 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | import org.springframework.validation.annotation.Validated; | 16 | import org.springframework.validation.annotation.Validated; |
| 21 | import org.springframework.web.bind.annotation.*; | 17 | import org.springframework.web.bind.annotation.*; |
| 22 | 18 | ||
| 23 | import java.sql.Timestamp; | ||
| 24 | import java.util.Objects; | 19 | import java.util.Objects; |
| 25 | 20 | ||
| 26 | @Api("会员处理") | 21 | @Api("会员处理") |
| ... | @@ -38,21 +33,11 @@ public class MemberOperationController { | ... | @@ -38,21 +33,11 @@ public class MemberOperationController { |
| 38 | @AnonymousAccess | 33 | @AnonymousAccess |
| 39 | public ResultInfo updateVipByMemberId(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) { | 34 | public ResultInfo updateVipByMemberId(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) { |
| 40 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); | 35 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); |
| 41 | Integer vip = resources.getVip(); | ||
| 42 | Timestamp vipExpireTime = resources.getVipExpireTime(); | ||
| 43 | Long memberId = resources.getMemberId(); | 36 | Long memberId = resources.getMemberId(); |
| 44 | MemberDTO memberDTO = this.memberOperationService.findById(memberId); | 37 | MemberDTO memberDTO = this.memberOperationService.findById(memberId); |
| 38 | resources.setMemberCode(memberDTO.getCode()); | ||
| 45 | 39 | ||
| 46 | Member member = new Member(); | 40 | return this.updateVipByMemberCode(resources); |
| 47 | BeanUtils.copyProperties(memberDTO, member); | ||
| 48 | if (Objects.nonNull(vip)) { | ||
| 49 | member.setVip(vip); | ||
| 50 | } | ||
| 51 | if (Objects.nonNull(vipExpireTime)) { | ||
| 52 | member.setVipExpireTime(vipExpireTime); | ||
| 53 | } | ||
| 54 | this.memberOperationService.doUpdateMemberVipAndVipExpireTime(member); | ||
| 55 | return ResultInfo.success(); | ||
| 56 | } | 41 | } |
| 57 | 42 | ||
| 58 | @RequestMapping(value = "/updateVipByMemberCode") | 43 | @RequestMapping(value = "/updateVipByMemberCode") |
| ... | @@ -71,28 +56,9 @@ public class MemberOperationController { | ... | @@ -71,28 +56,9 @@ public class MemberOperationController { |
| 71 | log.error("参数错误,vip为空或者小于0 , vip ==>> {}", vip); | 56 | log.error("参数错误,vip为空或者小于0 , vip ==>> {}", vip); |
| 72 | return ResultInfo.failure("参数错误,vip为空或者小于0"); | 57 | return ResultInfo.failure("参数错误,vip为空或者小于0"); |
| 73 | } | 58 | } |
| 74 | Timestamp vipExpireTime = resources.getVipExpireTime(); | ||
| 75 | |||
| 76 | |||
| 77 | Member member = new Member(); | ||
| 78 | member.setCode(memberCode); | ||
| 79 | member.setVip(vip); | ||
| 80 | member.setVipExpireTime(vipExpireTime); | ||
| 81 | |||
| 82 | MemberDTO memberDTO = this.memberOperationService.doUpdateMemberVipAndVipExpireTime(member); | ||
| 83 | this.createVipHistory(memberDTO.getId(), memberDTO.getCode(), vip, vipExpireTime); | ||
| 84 | |||
| 85 | return ResultInfo.success(); | ||
| 86 | } | ||
| 87 | 59 | ||
| 88 | 60 | MemberDTO memberDTO = this.memberOperationService.doUpdateVipByMemberCode(resources); | |
| 89 | private void createVipHistory(Long memberId, String code, Integer vip , Timestamp vipExpireTime){ | 61 | return ResultInfo.success(memberDTO); |
| 90 | BuyVipBean buyVipBean = new BuyVipBean(); | ||
| 91 | buyVipBean.setMemberId(memberId); | ||
| 92 | buyVipBean.setMemberCode(code); | ||
| 93 | buyVipBean.setVip(vip); | ||
| 94 | buyVipBean.setVipExpireTime(vipExpireTime); | ||
| 95 | this.memberOperationService.buyVipByMemberId(buyVipBean); | ||
| 96 | } | 62 | } |
| 97 | 63 | ||
| 98 | 64 | ||
| ... | @@ -104,27 +70,6 @@ public class MemberOperationController { | ... | @@ -104,27 +70,6 @@ public class MemberOperationController { |
| 104 | MemberProfileDTO memberProfileDTO = this.memberOperationService.getMemberProfileAndCheckVip(memberId, appId); | 70 | MemberProfileDTO memberProfileDTO = this.memberOperationService.getMemberProfileAndCheckVip(memberId, appId); |
| 105 | return ResultInfo.success(memberProfileDTO); | 71 | return ResultInfo.success(memberProfileDTO); |
| 106 | } | 72 | } |
| 107 | |||
| 108 | @PutMapping("/buyVip") | ||
| 109 | @ApiOperation("购买vip") | ||
| 110 | @AnonymousAccess | ||
| 111 | @Deprecated | ||
| 112 | public ResultInfo buyVip(@RequestBody BuyVipBean buyVipBean) { | ||
| 113 | |||
| 114 | /* // 小程序账户id | ||
| 115 | Long id = buyVipBean.getId(); | ||
| 116 | if (Objects.isNull(id)) | ||
| 117 | throw new BadRequestException("参数异常: id is null !"); | ||
| 118 | |||
| 119 | // vip等级 | ||
| 120 | Integer vip = buyVipBean.getVip(); | ||
| 121 | if (Objects.isNull(vip) || vip <= 0) | ||
| 122 | throw new BadRequestException("vip 等级有误"); | ||
| 123 | |||
| 124 | MemberDTO memberDTO = this.memberOperationService.buyVip(buyVipBean); | ||
| 125 | return ResultInfo.success(memberDTO);*/ | ||
| 126 | return null; | ||
| 127 | } | ||
| 128 | } | 73 | } |
| 129 | 74 | ||
| 130 | 75 | ... | ... |
| ... | @@ -61,23 +61,26 @@ public class PointsOperationController { | ... | @@ -61,23 +61,26 @@ public class PointsOperationController { |
| 61 | @AnonymousAccess | 61 | @AnonymousAccess |
| 62 | public ResultInfo addPoints(@Validated @RequestBody TempPoints tempPoints) { | 62 | public ResultInfo addPoints(@Validated @RequestBody TempPoints tempPoints) { |
| 63 | log.info("手动发放积分,参数 ==>>{} ", tempPoints); | 63 | log.info("手动发放积分,参数 ==>>{} ", tempPoints); |
| 64 | |||
| 64 | Long memberId = tempPoints.getMemberId(); | 65 | Long memberId = tempPoints.getMemberId(); |
| 65 | if (Objects.isNull(memberId)) { | 66 | if (Objects.isNull(memberId)) { |
| 66 | log.error("积分发放失败,参数错误,会员id 不存在"); | 67 | log.error("积分发放失败,参数错误,会员id 不存在"); |
| 67 | return ResultInfo.failure("积分发放失败,参数错误"); | 68 | return ResultInfo.failure("积分发放失败,参数错误"); |
| 68 | } | 69 | } |
| 70 | |||
| 69 | Long points = tempPoints.getPoints(); | 71 | Long points = tempPoints.getPoints(); |
| 70 | if (Objects.isNull(points) || points <= 0L) { | 72 | if (Objects.isNull(points) || points <= 0L) { |
| 71 | log.error("积分发放失败,参数错误,积分不存在或者积分小于0"); | 73 | log.error("积分发放失败,参数错误,积分不存在或者积分小于0"); |
| 72 | return ResultInfo.failure("积分发放失败,参数错误"); | 74 | return ResultInfo.failure("积分发放失败,参数错误"); |
| 73 | } | 75 | } |
| 76 | |||
| 74 | MemberDTO memberDTO = this.memberService.findById(memberId); | 77 | MemberDTO memberDTO = this.memberService.findById(memberId); |
| 75 | if (Objects.nonNull(memberDTO)) { | 78 | if (Objects.nonNull(memberDTO.getId())) { |
| 76 | String code = memberDTO.getCode(); | ||
| 77 | tempPoints.setMemberCode(code); | ||
| 78 | tempPoints.setMemberId(memberDTO.getId()); | 79 | tempPoints.setMemberId(memberDTO.getId()); |
| 80 | tempPoints.setMemberCode(memberDTO.getCode()); | ||
| 79 | this.pointsOperationService.grantPointsByManualByTempPoints(tempPoints); | 81 | this.pointsOperationService.grantPointsByManualByTempPoints(tempPoints); |
| 80 | } | 82 | } |
| 83 | |||
| 81 | return ResultInfo.success(); | 84 | return ResultInfo.success(); |
| 82 | } | 85 | } |
| 83 | 86 | ... | ... |
| ... | @@ -14,6 +14,7 @@ import com.topdraw.business.module.user.iptv.domain.UserTv; | ... | @@ -14,6 +14,7 @@ import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 14 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 14 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 15 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 15 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 16 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 16 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| 17 | import com.topdraw.business.process.domian.member.MemberOperationBean; | ||
| 17 | import com.topdraw.business.process.domian.weixin.*; | 18 | import com.topdraw.business.process.domian.weixin.*; |
| 18 | import com.topdraw.business.process.service.UserOperationService; | 19 | import com.topdraw.business.process.service.UserOperationService; |
| 19 | import com.topdraw.business.process.service.member.MemberOperationService; | 20 | import com.topdraw.business.process.service.member.MemberOperationService; |
| ... | @@ -89,30 +90,14 @@ public class UserOperationController { | ... | @@ -89,30 +90,14 @@ public class UserOperationController { |
| 89 | Long memberId = userWeixinDTO.getMemberId(); | 90 | Long memberId = userWeixinDTO.getMemberId(); |
| 90 | MemberDTO memberDTO = this.memberService.findById(memberId); | 91 | MemberDTO memberDTO = this.memberService.findById(memberId); |
| 91 | 92 | ||
| 92 | Member member = new Member(); | 93 | MemberOperationBean memberOperationBean = new MemberOperationBean(); |
| 93 | member.setId(memberDTO.getId()); | 94 | memberOperationBean.setMemberCode(memberDTO.getCode()); |
| 94 | member.setCode(memberDTO.getCode()); | 95 | memberOperationBean.setVip(vip); |
| 95 | if (Objects.nonNull(vip)) { | 96 | memberOperationBean.setVipExpireTime(vipExpireTime); |
| 96 | member.setVip(vip); | ||
| 97 | } | ||
| 98 | if (Objects.nonNull(vipExpireTime)) { | ||
| 99 | member.setVipExpireTime(vipExpireTime); | ||
| 100 | } | ||
| 101 | |||
| 102 | this.memberOperationService.doUpdateMemberVipAndVipExpireTime(member); | ||
| 103 | |||
| 104 | this.createVipHistory(userId, vip, vipExpireTime); | ||
| 105 | |||
| 106 | return ResultInfo.success(); | ||
| 107 | } | ||
| 108 | 97 | ||
| 98 | MemberDTO memberDTO1 = this.memberOperationService.doUpdateVipByMemberCode(memberOperationBean); | ||
| 109 | 99 | ||
| 110 | private void createVipHistory(Long weixinUserId, Integer vip , Timestamp vipExpireTime){ | 100 | return ResultInfo.success(memberDTO1); |
| 111 | BuyVipBean buyVipBean = new BuyVipBean(); | ||
| 112 | buyVipBean.setId(weixinUserId); | ||
| 113 | buyVipBean.setVip(vip); | ||
| 114 | buyVipBean.setVipExpireTime(vipExpireTime); | ||
| 115 | this.memberOperationService.buyVipByUserId(buyVipBean); | ||
| 116 | } | 101 | } |
| 117 | 102 | ||
| 118 | @PostMapping(value = "/createWeixinUserAndCreateMember") | 103 | @PostMapping(value = "/createWeixinUserAndCreateMember") | ... | ... |
| ... | @@ -160,10 +160,4 @@ public interface UserOperationService { | ... | @@ -160,10 +160,4 @@ public interface UserOperationService { |
| 160 | */ | 160 | */ |
| 161 | UserTvDTO updateUserTv(UserTv resources); | 161 | UserTvDTO updateUserTv(UserTv resources); |
| 162 | 162 | ||
| 163 | /** | ||
| 164 | * 修改大屏账号vis_user_id | ||
| 165 | * @param resources | ||
| 166 | * @return | ||
| 167 | */ | ||
| 168 | UserTvDTO updateUserTvVisUserId(UserTv resources); | ||
| 169 | } | 163 | } | ... | ... |
| ... | @@ -90,6 +90,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -90,6 +90,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
| 90 | if (Objects.isNull(expireTime)){ | 90 | if (Objects.isNull(expireTime)){ |
| 91 | tempPoints.setExpireTime(TimestampUtil.localDateTime2Timestamp(DateUtil.getLastDateTimeSecondYear())); | 91 | tempPoints.setExpireTime(TimestampUtil.localDateTime2Timestamp(DateUtil.getLastDateTimeSecondYear())); |
| 92 | } | 92 | } |
| 93 | |||
| 93 | this.refresh(tempPoints); | 94 | this.refresh(tempPoints); |
| 94 | } | 95 | } |
| 95 | 96 | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
| ... | @@ -11,13 +11,11 @@ import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO; | ... | @@ -11,13 +11,11 @@ import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO; |
| 11 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | 11 | import com.topdraw.business.process.service.member.MemberProfileOperationService; |
| 12 | import com.topdraw.exception.EntityExistException; | 12 | import com.topdraw.exception.EntityExistException; |
| 13 | import com.topdraw.exception.EntityNotFoundException; | 13 | import com.topdraw.exception.EntityNotFoundException; |
| 14 | import org.apache.commons.lang3.StringUtils; | ||
| 15 | import org.springframework.aop.framework.AopContext; | 14 | import org.springframework.aop.framework.AopContext; |
| 16 | import org.springframework.beans.BeanUtils; | 15 | import org.springframework.beans.BeanUtils; |
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 19 | 18 | ||
| 20 | import javax.validation.constraints.NotNull; | ||
| 21 | import java.util.Objects; | 19 | import java.util.Objects; |
| 22 | 20 | ||
| 23 | 21 | ||
| ... | @@ -39,25 +37,16 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation | ... | @@ -39,25 +37,16 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation |
| 39 | private MemberService memberService; | 37 | private MemberService memberService; |
| 40 | 38 | ||
| 41 | @AsyncMqSend | 39 | @AsyncMqSend |
| 42 | public void asyncMemberProfile(MemberProfileDTO memberProfileDTO){} | 40 | public void asyncUpdateMemberProfileAndSyncMember(MemberProfileAndMemberDTO memberProfileAndMemberDTO){} |
| 43 | @AsyncMqSend | 41 | @AsyncMqSend |
| 44 | public void asyncMemberProfileAndMember(MemberProfileAndMemberDTO memberProfileAndMemberDTO){} | 42 | public void asyncCreateMemberProfileAndSyncMember(MemberProfileDTO memberProfileDTO) {} |
| 45 | @AsyncMqSend | ||
| 46 | public void asyncCreateMemberProfile(MemberProfileDTO memberProfileDTO) {} | ||
| 47 | |||
| 48 | @Override | ||
| 49 | public MemberProfileDTO update(MemberProfile resources) { | ||
| 50 | MemberProfileDTO memberProfileDTO = this.memberProfileService.update(resources); | ||
| 51 | memberProfileDTO.setMemberCode(resources.getMemberCode()); | ||
| 52 | ((MemberProfileOperationServiceImpl) AopContext.currentProxy()).asyncMemberProfile(memberProfileDTO); | ||
| 53 | return memberProfileDTO; | ||
| 54 | } | ||
| 55 | 43 | ||
| 56 | @Override | 44 | @Override |
| 57 | public MemberProfileDTO updateMemberProfileAndMember(MemberProfile resources) { | 45 | public MemberProfileDTO updateMemberProfileAndMember(MemberProfile resources) { |
| 58 | Long id = resources.getId(); | 46 | Long id = resources.getId(); |
| 59 | MemberProfileDTO _memberProfile = this.memberProfileService.findById(id); | 47 | MemberProfileDTO memberProfile = this.memberProfileService.findById(id); |
| 60 | Long memberId = _memberProfile.getMemberId(); | 48 | |
| 49 | Long memberId = memberProfile.getMemberId(); | ||
| 61 | resources.setMemberId(memberId); | 50 | resources.setMemberId(memberId); |
| 62 | 51 | ||
| 63 | MemberDTO memberDTO = this.memberService.checkMember(resources.getMemberId(), resources.getMemberCode()); | 52 | MemberDTO memberDTO = this.memberService.checkMember(resources.getMemberId(), resources.getMemberCode()); |
| ... | @@ -68,7 +57,7 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation | ... | @@ -68,7 +57,7 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation |
| 68 | memberProfileDTO.setMemberCode(memberDTO.getCode()); | 57 | memberProfileDTO.setMemberCode(memberDTO.getCode()); |
| 69 | 58 | ||
| 70 | ((MemberProfileOperationServiceImpl)AopContext.currentProxy()) | 59 | ((MemberProfileOperationServiceImpl)AopContext.currentProxy()) |
| 71 | .asyncMemberProfileAndMember(new MemberProfileAndMemberDTO(memberProfileDTO, memberDTO)); | 60 | .asyncUpdateMemberProfileAndSyncMember(new MemberProfileAndMemberDTO(memberProfileDTO, memberDTO)); |
| 72 | 61 | ||
| 73 | return memberProfileDTO; | 62 | return memberProfileDTO; |
| 74 | } | 63 | } |
| ... | @@ -88,7 +77,7 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation | ... | @@ -88,7 +77,7 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation |
| 88 | 77 | ||
| 89 | this.createMemberProfileAndSyncMember(memberProfileDTO, memberDTO); | 78 | this.createMemberProfileAndSyncMember(memberProfileDTO, memberDTO); |
| 90 | 79 | ||
| 91 | ((MemberProfileOperationServiceImpl) AopContext.currentProxy()).asyncCreateMemberProfile(memberProfileDTO); | 80 | ((MemberProfileOperationServiceImpl) AopContext.currentProxy()).asyncCreateMemberProfileAndSyncMember(memberProfileDTO); |
| 92 | 81 | ||
| 93 | } else { | 82 | } else { |
| 94 | 83 | ||
| ... | @@ -112,13 +101,11 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation | ... | @@ -112,13 +101,11 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation |
| 112 | 101 | ||
| 113 | private void syncMember(MemberProfileDTO memberProfileDTO, MemberDTO memberDTO) { | 102 | private void syncMember(MemberProfileDTO memberProfileDTO, MemberDTO memberDTO) { |
| 114 | Member member = new Member(); | 103 | Member member = new Member(); |
| 115 | |||
| 116 | member.setId(memberDTO.getId()); | 104 | member.setId(memberDTO.getId()); |
| 117 | member.setCode(memberDTO.getCode()); | 105 | member.setCode(memberDTO.getCode()); |
| 118 | member.setAvatarUrl(memberProfileDTO.getAvatarUrl()); | 106 | member.setAvatarUrl(memberProfileDTO.getAvatarUrl()); |
| 119 | member.setNickname(memberProfileDTO.getRealname()); | 107 | member.setNickname(memberProfileDTO.getRealname()); |
| 120 | member.setGender(memberProfileDTO.getGender()); | 108 | member.setGender(memberProfileDTO.getGender()); |
| 121 | // this.memberService.update(member); | ||
| 122 | this.memberService.doUpdateMemberAvatarUrlAndNicknameAndGender(member); | 109 | this.memberService.doUpdateMemberAvatarUrlAndNicknameAndGender(member); |
| 123 | } | 110 | } |
| 124 | 111 | ... | ... |
| ... | @@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member; | ... | @@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member; |
| 4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 6 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | 6 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; |
| 7 | import com.topdraw.business.process.domian.member.MemberOperationBean; | ||
| 7 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | 8 | import com.topdraw.business.process.domian.weixin.BuyVipBean; |
| 8 | 9 | ||
| 9 | public interface MemberOperationService { | 10 | public interface MemberOperationService { |
| ... | @@ -31,26 +32,6 @@ public interface MemberOperationService { | ... | @@ -31,26 +32,6 @@ public interface MemberOperationService { |
| 31 | MemberProfileDTO getMemberProfileAndCheckVip(Long memberId, String appid); | 32 | MemberProfileDTO getMemberProfileAndCheckVip(Long memberId, String appid); |
| 32 | 33 | ||
| 33 | /** | 34 | /** |
| 34 | * | ||
| 35 | * @param resources | ||
| 36 | * @return | ||
| 37 | */ | ||
| 38 | MemberDTO buyVipByUserId(BuyVipBean resources); | ||
| 39 | |||
| 40 | /** | ||
| 41 | * | ||
| 42 | * @param resources | ||
| 43 | * @return | ||
| 44 | */ | ||
| 45 | MemberDTO buyVipByMemberId(BuyVipBean resources); | ||
| 46 | |||
| 47 | /** | ||
| 48 | * | ||
| 49 | * @param memberVipHistory | ||
| 50 | */ | ||
| 51 | void createVipHistory(MemberVipHistory memberVipHistory); | ||
| 52 | |||
| 53 | /** | ||
| 54 | * 修改会员 | 35 | * 修改会员 |
| 55 | * @param resources | 36 | * @param resources |
| 56 | */ | 37 | */ |
| ... | @@ -60,12 +41,6 @@ public interface MemberOperationService { | ... | @@ -60,12 +41,6 @@ public interface MemberOperationService { |
| 60 | * | 41 | * |
| 61 | * @param resources | 42 | * @param resources |
| 62 | */ | 43 | */ |
| 63 | MemberDTO doUpdateMember(Member resources); | ||
| 64 | |||
| 65 | /** | ||
| 66 | * | ||
| 67 | * @param resources | ||
| 68 | */ | ||
| 69 | MemberDTO doInsertMember(Member resources); | 44 | MemberDTO doInsertMember(Member resources); |
| 70 | 45 | ||
| 71 | /** | 46 | /** |
| ... | @@ -91,4 +66,10 @@ public interface MemberOperationService { | ... | @@ -91,4 +66,10 @@ public interface MemberOperationService { |
| 91 | * @param member | 66 | * @param member |
| 92 | */ | 67 | */ |
| 93 | MemberDTO doUpdateMemberVipAndVipExpireTime(Member member); | 68 | MemberDTO doUpdateMemberVipAndVipExpireTime(Member member); |
| 69 | |||
| 70 | /** | ||
| 71 | * | ||
| 72 | * @param resources | ||
| 73 | */ | ||
| 74 | MemberDTO doUpdateVipByMemberCode(MemberOperationBean resources); | ||
| 94 | } | 75 | } | ... | ... |
| ... | @@ -6,12 +6,6 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ... | @@ -6,12 +6,6 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 6 | public interface MemberProfileOperationService { | 6 | public interface MemberProfileOperationService { |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * 修改 | ||
| 10 | * @param resources | ||
| 11 | */ | ||
| 12 | MemberProfileDTO update(MemberProfile resources); | ||
| 13 | |||
| 14 | /** | ||
| 15 | * 修改会员属性并同步会员信息 | 9 | * 修改会员属性并同步会员信息 |
| 16 | * @param resources | 10 | * @param resources |
| 17 | */ | 11 | */ | ... | ... |
| 1 | package com.topdraw.config; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description:\ | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/18 13:25 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/18 13:25 | ||
| 11 | */ | ||
| 12 | public interface RedisKeyConstants { | ||
| 13 | |||
| 14 | String cacheMemberById = "uce::member::id"; | ||
| 15 | String updateCacheMemberById = "uce::updateMember::id"; | ||
| 16 | |||
| 17 | String updateCachePointsByMemberId = "uce::updatePoints::memberId"; | ||
| 18 | String updateCacheExpByMemberId = "uce::updateExp::memberId"; | ||
| 19 | String updateCacheCouponByMemberId = "uce::updateCoupon::memberId"; | ||
| 20 | |||
| 21 | String cacheUserTvByPlatformAccount = "uce::userTv::platformAccount"; | ||
| 22 | String cacheTaskProcessByMemberId = "uce::taskProcess::memberId"; | ||
| 23 | String cacheTaskByTaskTemplateId = "uce::task::taskTemplateId"; | ||
| 24 | } |
| 1 | package com.topdraw.config; | ||
| 2 | |||
| 3 | |||
| 4 | import com.fasterxml.jackson.annotation.JsonAutoDetect; | ||
| 5 | import com.fasterxml.jackson.annotation.PropertyAccessor; | ||
| 6 | import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 7 | import lombok.extern.slf4j.Slf4j; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.cache.annotation.CachingConfigurerSupport; | ||
| 10 | import org.springframework.context.annotation.Bean; | ||
| 11 | import org.springframework.context.annotation.Configuration; | ||
| 12 | import org.springframework.context.annotation.Primary; | ||
| 13 | import org.springframework.data.redis.cache.RedisCacheConfiguration; | ||
| 14 | import org.springframework.data.redis.cache.RedisCacheManager; | ||
| 15 | import org.springframework.data.redis.connection.RedisConnectionFactory; | ||
| 16 | import org.springframework.data.redis.core.RedisTemplate; | ||
| 17 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; | ||
| 18 | |||
| 19 | import java.time.Duration; | ||
| 20 | import java.util.HashSet; | ||
| 21 | import java.util.Set; | ||
| 22 | import java.util.concurrent.ConcurrentHashMap; | ||
| 23 | |||
| 24 | /** | ||
| 25 | * @author : | ||
| 26 | * @description: | ||
| 27 | * @function : | ||
| 28 | * @date :Created in 2022/6/19 16:30 | ||
| 29 | * @version: : | ||
| 30 | * @modified By: | ||
| 31 | * @since : modified in 2022/6/19 16:30 | ||
| 32 | */ | ||
| 33 | @Slf4j | ||
| 34 | @Configuration | ||
| 35 | public class UceRedisConfig { | ||
| 36 | |||
| 37 | @Autowired | ||
| 38 | private RedisConfig redisConfig; | ||
| 39 | @Autowired | ||
| 40 | private RedisConnectionFactory redisConnectionFactory; | ||
| 41 | |||
| 42 | @Bean(value = "uceRedisTemplate") | ||
| 43 | public RedisTemplate<Object, Object> uceRedisTemplate() { | ||
| 44 | return redisConfig.redisTemplate(redisConnectionFactory); | ||
| 45 | } | ||
| 46 | /** | ||
| 47 | * 自定义缓存管理器 | ||
| 48 | */ | ||
| 49 | @Bean(value = "uceCacheManagemer") | ||
| 50 | @Primary | ||
| 51 | public RedisCacheManager cacheManager(RedisConnectionFactory factory) { | ||
| 52 | RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig(); | ||
| 53 | Set<String> cacheNames = new HashSet<>(); | ||
| 54 | // cacheNames.add("car"); | ||
| 55 | // cacheNames.add(RedisKeyConstants.cacheTaskByEvent); | ||
| 56 | cacheNames.add(RedisKeyConstants.cacheTaskProcessByMemberId); | ||
| 57 | ConcurrentHashMap<String, RedisCacheConfiguration> configMap = new ConcurrentHashMap<>(); | ||
| 58 | // configMap.put("car", config.entryTtl(Duration.ofMinutes(6L))); | ||
| 59 | configMap.put(RedisKeyConstants.cacheTaskProcessByMemberId, config.entryTtl(Duration.ofDays(1))); | ||
| 60 | // configMap.put(RedisKeyConstants.cacheTaskByEvent, config); | ||
| 61 | |||
| 62 | //需要先初始化缓存名称,再初始化其它的配置。 | ||
| 63 | RedisCacheManager cacheManager = RedisCacheManager.builder(factory). | ||
| 64 | initialCacheNames(cacheNames).withInitialCacheConfigurations(configMap).build(); | ||
| 65 | return cacheManager; | ||
| 66 | } | ||
| 67 | } |
| ... | @@ -23,35 +23,6 @@ public class MemberOperationServiceTest extends BaseTest { | ... | @@ -23,35 +23,6 @@ public class MemberOperationServiceTest extends BaseTest { |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | @Test | 25 | @Test |
| 26 | public void doUpdateMemberInfo() { | ||
| 27 | Member member = new Member(); | ||
| 28 | member.setId(2L); | ||
| 29 | member.setCode(String.valueOf(IdWorker.generator())); | ||
| 30 | member.setType(1); | ||
| 31 | member.setStatus(1); | ||
| 32 | member.setNickname("nickname"); | ||
| 33 | member.setDescription("description"); | ||
| 34 | member.setGender(1); | ||
| 35 | member.setBirthday("birthday"); | ||
| 36 | member.setAvatarUrl("avatarUrl"); | ||
| 37 | member.setGroups("groups"); | ||
| 38 | member.setTags("tags"); | ||
| 39 | member.setVip(1); | ||
| 40 | member.setLevel(1); | ||
| 41 | member.setExp(10L); | ||
| 42 | member.setPoints(5L); | ||
| 43 | member.setDuePoints(0L); | ||
| 44 | member.setCouponAmount(1L); | ||
| 45 | member.setDueCouponAmount(0L); | ||
| 46 | member.setUserIptvId(1L); | ||
| 47 | member.setBindIptvPlatformType(0); | ||
| 48 | member.setUpdateTime(TimestampUtil.now()); | ||
| 49 | String s = JSONObject.toJSONString(member); | ||
| 50 | |||
| 51 | this.memberOperationService.doUpdateMember(member); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Test | ||
| 55 | public void doInsertMember() { | 26 | public void doInsertMember() { |
| 56 | Member member = new Member(); | 27 | Member member = new Member(); |
| 57 | member.setCode(String.valueOf(IdWorker.generator())); | 28 | member.setCode(String.valueOf(IdWorker.generator())); | ... | ... |
-
Please register or sign in to post a comment