1.优化
Showing
3 changed files
with
32 additions
and
6 deletions
| 1 | package com.topdraw.business.process.domian.member; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | /** | ||
| 6 | * @author : | ||
| 7 | * @description: | ||
| 8 | * @function : | ||
| 9 | * @date :Created in 2022/4/7 12:48 | ||
| 10 | * @version: : | ||
| 11 | * @modified By: | ||
| 12 | * @since : modified in 2022/4/7 12:48 | ||
| 13 | */ | ||
| 14 | @Data | ||
| 15 | public class MemberOperationBean { | ||
| 16 | |||
| 17 | private Long memberId; | ||
| 18 | |||
| 19 | private Integer vip; | ||
| 20 | |||
| 21 | } |
| ... | @@ -6,6 +6,7 @@ import com.topdraw.business.module.common.validated.UpdateGroup; | ... | @@ -6,6 +6,7 @@ import com.topdraw.business.module.common.validated.UpdateGroup; |
| 6 | import com.topdraw.business.module.member.domain.Member; | 6 | import com.topdraw.business.module.member.domain.Member; |
| 7 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 7 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 9 | import com.topdraw.business.process.domian.member.MemberOperationBean; | ||
| 9 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | 10 | import com.topdraw.business.process.domian.weixin.BuyVipBean; |
| 10 | import com.topdraw.business.process.service.member.MemberOperationService; | 11 | import com.topdraw.business.process.service.member.MemberOperationService; |
| 11 | import com.topdraw.common.IResultInfo; | 12 | import com.topdraw.common.IResultInfo; |
| ... | @@ -14,6 +15,7 @@ import com.topdraw.exception.BadRequestException; | ... | @@ -14,6 +15,7 @@ import com.topdraw.exception.BadRequestException; |
| 14 | import io.swagger.annotations.Api; | 15 | import io.swagger.annotations.Api; |
| 15 | import io.swagger.annotations.ApiOperation; | 16 | import io.swagger.annotations.ApiOperation; |
| 16 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
| 18 | import org.springframework.beans.BeanUtils; | ||
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.validation.annotation.Validated; | 20 | import org.springframework.validation.annotation.Validated; |
| 19 | import org.springframework.web.bind.annotation.*; | 21 | import org.springframework.web.bind.annotation.*; |
| ... | @@ -31,15 +33,18 @@ public class MemberOperationController { | ... | @@ -31,15 +33,18 @@ public class MemberOperationController { |
| 31 | private MemberOperationService memberOperationService; | 33 | private MemberOperationService memberOperationService; |
| 32 | 34 | ||
| 33 | @Log("手动修改vip") | 35 | @Log("手动修改vip") |
| 34 | @RequestMapping(value = "/doUpdateVipByCode") | 36 | @RequestMapping(value = "/doUpdateVipByMemberId") |
| 35 | @ApiOperation("手动修改vip") | 37 | @ApiOperation("手动修改vip") |
| 36 | @AnonymousAccess | 38 | @AnonymousAccess |
| 37 | public ResultInfo doUpdateVipByCode(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) { | 39 | public ResultInfo doUpdateVipByMemberId(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) { |
| 38 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); | 40 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); |
| 39 | 41 | ||
| 40 | MemberDTO memberDTO = this.memberOperationService.findByCode(resources.getCode()); | 42 | Long memberId = resources.getMemberId(); |
| 41 | resources.setId(memberDTO.getId()); | 43 | MemberDTO memberDTO = this.memberOperationService.findById(memberId); |
| 42 | this.memberOperationService.update(resources); | 44 | |
| 45 | Member member = new Member(); | ||
| 46 | BeanUtils.copyProperties(memberDTO, member); | ||
| 47 | this.memberOperationService.update(member); | ||
| 43 | log.info("member ==>> doUpdateVipByCode ==>> result ==>> [{}]",resources); | 48 | log.info("member ==>> doUpdateVipByCode ==>> result ==>> [{}]",resources); |
| 44 | return ResultInfo.success(); | 49 | return ResultInfo.success(); |
| 45 | } | 50 | } | ... | ... |
| ... | @@ -106,7 +106,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -106,7 +106,7 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | @AsyncMqSend | 108 | @AsyncMqSend |
| 109 | @CachePut(key = "#resources.id") | 109 | // @CachePut(key = "#resources.id") |
| 110 | @Override | 110 | @Override |
| 111 | public MemberDTO update(Member resources) { | 111 | public MemberDTO update(Member resources) { |
| 112 | MemberDTO memberDTO = this.memberService.update(resources); | 112 | MemberDTO memberDTO = this.memberService.update(resources); | ... | ... |
-
Please register or sign in to post a comment